HOME JCL COBOL DB2 VSAM CICS


DB2 Interview Questions

11. How can the FIRSTNAME and the LASTNAME from the EMP table be concatenated to generate complete names?
The statement that can be used to concatenate the first and last names to display full names:FIRSTNAME II ** II LASTNAME FROM EMP

12. What could be the reason that the MySQL statement 'SELECT AVG (SALARY) FROM EMP' generates an inaccurate output?
The reason for the statement generating an inaccurate outcome is that SALARY has not been declared to have NULL values and, at the same time, the employees whose salary is not known are also counted.

13. What is a CURSOR and what is its use?
A CURSOR is a programming device that helps the SELECT statement find out a set of rows but displays them one at a time. This is because the host language can deal with only one row at a time.

14. How to retrieve rows from a DB2 table in Embedded SQL?
Rows from a DB2 table in Embedded SQL can be retrieved using the single-row SELECT statement. Another way is by using the CURSOR statement. However, the first process is the preferred one.

15. What is the result of the OPEN CURSOR statement?
In the simple OPEN CURSOR statement, the CURSOR is placed on the first row of a table. On the other hand, when the ORDER BY clause is added, rows would be fetched, sorted, and would be available for the FETCH statement.

16. Can there be more than one cursor open for any program?
Yes! The user can have more than one cursor open for any program.

17. How would the VARCHAR column REMARKS be defined?
The VARCHAR column REMARKS would be defined as follows:10 REMARKS;49 REMARKS-LEN PIC S9(4) USAGE COMP;49 REMARKS-TEXT PIC X(1920);

18. What is the physical storage length of each of the data types, DATE, TIME, and TIMESTAMP?
The physical storage length of DATE is 4 bytes, TIME is 3 bytes, and TIMESTAMP is 10 bytes.

19. What is meant by DCLGEN?
DCLGEN refers to Declaration Generator that is used to create the host language copy books for the table definitions. It also creates the DECLARE table.

20. What are the contents of DCLGEN?
DCLGEN has the EXEC SQL DECLARE TABLE statement that gives the layout of a table/view in terms of DB2 data types. It can also be defined as the host language copy book giving the host variable definitions for column names.

1 2 3 4 5
Copyright 2020 by ibmmainframer. All Rights Reserved.