DB2 interview question set 2/DB2 Interview Questions and Answers for Freshers & Experienced

Mention the length of physical storage of the given data types of DB2 – DATE, TIMESTAMP, TIME

DATE: PIC X (10)


TIME: PIC X (08)

Posted Date:- 2021-09-03 10:14:46

Mention the definition of COBOL in VARCHAR field.

The REMARKS of VARCHAR column are as follows: –



49 REMARKS – TEXT PIC X (1920).



49 REMARKS – TEXT PIC X (1920).

Posted Date:- 2021-09-03 10:14:05

Why SELECT is not preferred in embedded SQL programs?

SELECT is not preferred in embedded SQL programs for three reasons. First; if the table structure is changed by the addition or deletion of a field and the program is modified then using SELECT might retrieve the columns that the user may not use. This would lead to Input-Output overhead and the chances of an index-only scan are also eliminated.

Posted Date:- 2021-09-03 10:12:53

When will you choose to run RUNSTATS?

After a load, or after mass updates, inserts, deletes, or after REORG.

What is the reason that the MySQL statement “SELECT AVG (SALARY) FROM EMP” generates inaccurate output? The reason for the statement generating inaccurate outcomes is because of the fact that SALARY has not been declared to have NULL and at the same time the employees whose salary is not known are also counted.

Posted Date:- 2021-09-03 10:11:43

How do you insert a record with a nullable column?

To insert a NULL, move -1 to the null indicator. To insert a valid value, move 0 to the null indicator

Posted Date:- 2021-09-03 10:10:55

What does it mean if the null indicator has -1, 0, -2?

-1: the field is null; 0: the field is not null; -2: the field value is truncated

Posted Date:- 2021-09-03 10:10:18

How do you retrieve the data from a nullable column?

Use null indicators. Syntax .. INTO HOSTVAR: NULLED

Posted Date:- 2021-09-03 10:09:43

How does DB2 store NULL physically?

As an extra-byte prefix to the column value. Physically, the null prefix is Hex '00" if the value is present and Hex 'FF' if it is not.

Posted Date:- 2021-09-03 10:09:12

Suppose I have a program that uses a dynamic SQL and it has been performing well till now. Off late, I find that performance has deteriorated. What happened?

There may be one of the following reasons:

probably RUN STATS is not done and the program is using a wrong index due to incorrect stats.

probably RUN STATS is done and the optimizer has chosen a wrong access path based on the latest statistics.

Posted Date:- 2021-09-03 10:08:35

When is the access path determined for dynamic SQL?

At run time, when the PREPARE statement is issued.

Posted Date:- 2021-09-03 10:07:51

What is a collection?

A user-defined name that is the anchor for packages. It has no physical existence. The main usage is to group packages.

Posted Date:- 2021-09-03 10:07:18

What are the advantages of using a PACKAGE?

The advantages of using PACKAGE are :

Avoid having to bind a large number of DBRM members into a plan

Avoid the cost of a large bind

Avoid the entire transaction being unavailable during bind and automatic rebind of a plan

Minimize fallback complexities if changes result in an error.

Posted Date:- 2021-09-03 10:06:47

What else is there Ain the PLN apart from the access path?

PLAN has the executable code for the SQL statements in the host program

Posted Date:- 2021-09-03 10:06:11

What is a DBRM, PLAN?

DBRM: DataBase Request Module, has the SQL statements extracted from the host language program by the pre-compiler. PLAN: A result of the BIND process. It has the executable code for the SQL statements in the DBRM.

Posted Date:- 2021-09-03 10:05:35

What is ALTER?

SQL command used to change the definition of DB2 objects.

Posted Date:- 2021-09-03 10:05:05

What is lock escalation?

Promoting a PAGE lock-size to the table or tablespace lock-size when a transaction has acquired more lock than specified in NUMLKTS. Locks should be taken on objects in single tablespace for escalation to occur.

Posted Date:- 2021-09-03 10:04:33

How does DB2 determine what lock-size to use?

There are three methods to determine lock-size. They are;

-Based on the lock-size given while creating the tablespace.

-Programming can direct the DB2 what lock-size to use

-If lock-size ANY is specified, DB2 usually chooses a lock-size of PAGE

Posted Date:- 2021-09-03 10:03:43

When do you specify the isolation level? How?

During the BIND process (ISOLATION LEVEL is a parameter for the binding process ). ISOLATION (CS/PR)..

Posted Date:- 2021-09-03 10:03:01

What is the difference between CS and RR isolation levels?

CS: Release the lock on a page after use

RR: Retains all locks acquired till the end of the transaction

Posted Date:- 2021-09-03 10:02:28

How do you do the EXPLAIN of a dynamic SQL statement?

There are two methods to achieve this:

Use SPUFI or QMF to EXPLAIN the dynamic SQL statement

Include EXPLAIN command in the embedded by dynamic SQL statements

Posted Date:- 2021-09-03 10:01:25

How do you leave the cursor open after issuing a COMMIT?

Use WITH HOLD option in DECLARE CURSOR statement. But, it has no effect on pseudo-conversational CICS programs.

Posted Date:- 2021-09-03 10:00:33

What Is Join And Different Types Of Join?

The ability to join rows and combaine data from two or more tables is one of the most powerful features of relational system.Three type of joins:

1. Equi-join
2. Non-equijoin
3. self-join.

Posted Date:- 2021-09-03 09:59:29

B37 Abend During Spufi?

The b37 abend in the spufi is because of space requirements , the query has resulted in so many rows that the spufi.out file is not large enough to handle it, increase the space allocation of spufi.out file.

Posted Date:- 2021-09-03 09:58:46

When Can You Be Sure That A Query Will Return Only One Row?

When you use the primary key and only the primary key in the where clause.

Posted Date:- 2021-09-03 09:58:18

What Is The Difference Between Join And Union?

join is used to retrive data from different tables using a single sql statement.union is used to combine the results of two or more sql querries.

Posted Date:- 2021-09-03 09:57:49

What Is A Corelated Subquerry?

In a subquerry, if the outer querry reffers back to the outcome of innerquerry it is called corelated subquerry. That's why the outer querry is evaluated first unlike an ordinary subquerry.

Posted Date:- 2021-09-03 09:57:23

What Are The Functions Of Bind?

BIND mainly performs two things syntax checking and authorization checking.It binds together all packages into an application plan hence the name BIND.Apart from this bind has optimiser as a subcomponent.Its function is to determine the optimum access strategy.

Posted Date:- 2021-09-03 09:56:49

What's The Best Locksize That You Could Use When You Create A Tablespace?

The answer is Locksize = ANY.Unless you are Sure what's the Purpose of tablespace ie.,Read-only or R/W.If you use lock size =any, Db2 would automatically determine what type of locks it should use.

Posted Date:- 2021-09-03 09:56:24

What Does Currentdata Option In Bind Indicate?

CURRENTDATA option ensures block fetch while selecting rows from a table. In DB2V4 the default has been changed to NO. Therefore it is necessary to change all the bind cards with CURRENTDATA(YES) which is default in DB2V3 & earlier to CURRENTDATA(NO).

Posted Date:- 2021-09-03 09:56:00

What Is The Difference Between Type 1 Index & Type 2 Index?

TYPE 1 & TYPE 2 are specified when an index is created on the table. TYPE 2 index is the option which comes with DB2V4. With TYPE 2 index data can be retreived faster as only the data pages are locked and not the index pages. Hence TYPE 2 index is recommended.

Posted Date:- 2021-09-03 09:55:38

What Are The Levels Of Isolation Available With Db2v4?

CS RR UR( added new for DB2V4 which stands for uncommited read which allows to retreive records from the space which has exclusive locks also but data integrity will be affected if this option is used )The best available option for data integrity & data concurrency is CS.

Posted Date:- 2021-09-03 09:55:09

What Is The Sql Communications Area And What Are Some Of Its Key Fields?

It is a data structure that must be included in any host-language program using SQL. It is used to pass feedback about the sql operations to the program. Fields are return codes, error messages, handling codes and warnings.

Posted Date:- 2021-09-03 09:54:33

Once You Create A View, Where Would Information About The View Be Stored?

When a view is created, system information about the view is stored in SYSIBM.SYSVIEWS.

Posted Date:- 2021-09-03 09:54:02

What Is Meant By Repeatable Read?

When an application program executes with repeatable read protection, rows referenced by the program can’t be changed by other programs until the program reaches a commit point.

Posted Date:- 2021-09-03 09:52:39

What information is contained in an SYSCOPY entry?

Included is the name of the database, the tablespace name, and the image copy type (full or incremental, etc..) as well as the date and time each copy was made.

Posted Date:- 2021-09-03 09:50:59

What information is held in SYSIBM.SYSCOPY?

The SYSIBM.SYSCOPY table contains information about image copies made of the tablespaces.

Posted Date:- 2021-09-03 09:50:36

What is the format (internal layout) of "TIMESTAMP"?

This is a seven-part value that consists of a date (yymmdd) and time (hhmmss and microseconds)

Posted Date:- 2021-09-03 09:50:00

How would you move a tablespace ( using STOGROUP ) to a different DASD volume allocated to that tablespace?

If the tablespace used is only allocated do that STOGROUP :

ALTER STOGROUP- add volume (new ) delete volume (old )


Create a new STOGROUP that points to the new volume. ALTER the tablespace and REORG or RECOVER the tablespace.

Posted Date:- 2021-09-03 09:49:34

What is meant by repeatable read?

When an application program executes with repeatable read protection, rows referenced by the program can't be changed by other programs until the program reaches a commit point.

Posted Date:- 2021-09-03 09:49:07

What is a predicate?

A predicate is an element of a search condition that expresses or implies a comparison operation.

Posted Date:- 2021-09-03 09:48:28

What is a host variable?

This is a data item that is used in an SQL statement to receive a value or to supply a value. It must be preceded by a colon (:) to tell DB2 that the variable is not a column name.

Posted Date:- 2021-09-03 09:47:43

What is the function of the Data Manager?

The Data Manager is a DB2 component that manages the physical databases. It invokes other system components, as necessary, to perform detailed functions such as locking, logging, and physical I/O operations ( such as search, retrieval, update, and index maintenance).

Posted Date:- 2021-09-03 09:47:12

What will the COMMIT accomplish?

COMMIT will allow data changes to be permanent. This then permits the data to be accessed by other units of work. When a COMMIT occurs, locks are freed so other applications can reference the just committed data.

Posted Date:- 2021-09-03 09:46:43

What is meant by UNION and UNION ALL?

UNION – It is the function that eliminates duplicates from the table.
UNION ALL – It is the function used to retain the duplicates in the table.
Both the functions are used to combine the results generated by multiple SELECT statements.

Posted Date:- 2021-09-03 09:45:55


There is a certain point in a program at which DB2 acquires or perhaps releases the locks against tables as well as table-spaces. These include intent locks.

Posted Date:- 2021-09-03 09:44:37

What is meant by EXPLAIN?

EXPLAIN is basically used to show the path of access by the optimizer basically for an SQL statement. Furthermore, EXPLAIN can also be brought to use in SPUFI or even in BIND step.

Posted Date:- 2021-09-03 09:44:07

In case if at some point of time DB2 is down, would that impact the pre-compilation process of a DB2-COBOL program?

Even if DB2 is down at some point of time, even then it will not impact the pre-compilation process of DB2-COBOL program. The reason for the same is that the pre-compiler never refers to the catalogue tables of DB2.

Posted Date:- 2021-09-03 09:43:40

Explain the contents that are a part of DCLGEN.

There are primarily two components of DCLGEN. These are: –

A copy book of the host language, which will give alternative definitions for all the column names.
In terms of the data-types of DB2, EXEC SQL DECLARE TABLE shows an aesthetic layout of the table.

Posted Date:- 2021-09-03 09:41:27

Mention some fields that are a part of SQLCA.


Posted Date:- 2021-09-03 09:40:50


PACKAGES are units, which consist of executable codes that are meant for SQL statements for one respective DBRM.

Posted Date:- 2021-09-03 09:40:18

R4R Team
R4R provides DB2 Freshers questions and answers (DB2 Interview Questions and Answers) .The questions on R4R.in website is done by expert team! Mock Tests and Practice Papers for prepare yourself.. Mock Tests, Practice Papers,DB2 interview question set 2,DB2 Freshers & Experienced Interview Questions and Answers,DB2 Objetive choice questions and answers,DB2 Multiple choice questions and answers,DB2 objective, DB2 questions , DB2 answers,DB2 MCQs questions and answers R4r provides Python,General knowledge(GK),Computer,PHP,SQL,Java,JSP,Android,CSS,Hibernate,Servlets,Spring etc Interview tips for Freshers and Experienced for DB2 fresher interview questions ,DB2 Experienced interview questions,DB2 fresher interview questions and answers ,DB2 Experienced interview questions and answers,tricky DB2 queries for interview pdf,complex DB2 for practice with answers,DB2 for practice with answers You can search job and get offer latters by studing r4r.in .learn in easy ways .