Now, Get RPG Codes in all three formats only on this website on every RPGLE related programming article.

Fixed, /Free and Fully Free RPG


DB2 Interview questions and answers

This article contain DB2 interview questions and answers.
DB2 Interview questions and answers, interview questions,  SQLCAID, SQLCODE, SQLCA, SQL, OPEN CURSOR statement,  UNION, UNION ALL, DB2 SELECT, SELECT DISTINCT, RPG program, sql statement, embedded sql, ALTER command in SQL DB2, eliminate duplicte rows using SQL, Find count using SQL, Can we use MAX SQL function on character fields, Using cursor in RPG Embedded SQL,as400, ibmi, iseries,systemi, SQL, as400 and SQL Tricks
DB2 Interview questions and answers

Q1: What is ALTER?

Answer 1:

ALTER is an SQL statement that is used to change the structure of any objects like table structure, add any field, etc.

Q2: What are some of the main fields in SQLCA?

Answer 2:

There are various fields in SQLCA. Some are SQLCAID, SQLCODE which contain the error code.

Q3: What is the physical storage length of each of the data types DATE, TIME, and TIMESTAMP?

Answer 3:

The physical storage length of each of the data types DATE, TIME, and TIMESTAMP are 4 bytes, 3 bytes, and 10 bytes.

Q4: Can there be more than one cursor open for any program?

Answer 4:

Yes, there can be more than one cursor open for any program.

Q5: What is the result of the OPEN CURSOR statement?

Answer 5:

The OPEN CURSOR statement opens a cursor that is used to fetch rows from its result table and it sets the pointer to the first record of the table from where the records have to process one by one.

Q6: Is there any restriction on the use of UNION embedded SQL?

Answer 6:

Yes, there is a restriction that UNION can only be used in a cursor when its being used as embedded SQL in an RPG program.

Q7: What are UNION and UNION ALL?

Answer 7:

UNION and UNION ALL are SQL operators used to concatenate 2 or more result sets where UNION selects only unique records and UNION ALL keeps all records, including duplicates.

Q8: Is it possible to use MAX on a CHAR column?

Answer 8:

Yes.

Q9: How can the duplicate values be eliminated from DB2 SELECT?

Answer 9:

Using SELECT DISTINCT to eliminate duplicate rows and that would be applicable to all columns.

Q10: How to find the number of rows in a DB2 table?

Answer 10:

The COUNT (*) function is used to find the number of rows in a DB2 table.

Post a Comment

© AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain