Question:- Is there any restriction on the use of UNION in Embedded SQL?
Answer:- While using UNION in Embedded SQL, it has to be in a CURSOR.
Question:- What do you mean by BETWEEN and IN? Is BETWEEN inclusive of specified range values?
Answer:- BETWEEN would supply a range of values, whereas IN would provide a list of values. BETWEEN is always inclusive of the range values specified.
Question:- How can the FIRSTNAME and the LASTNAME from the EMP table be concatenated to generate complete names?
Answer:- Below is the statement that can be used to concatenate the first and last names to display full names: FIRSTNAME II ** II LASTNAME FROM EMP
Question:- What is a CURSOR and what is its use?
Answer:- 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.
Question:- How to retrieve rows from a DB2 table in Embedded SQL?
Answer:- 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.
Question:- What is the result of the OPEN CURSOR statement?
Answer:- 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.
Question:- Can there be more than one cursor open for any program?
Answer:- Yes! The user can have more than one cursor open for any program.
Question:- How would the VARCHAR column REMARKS be defined?
Answer:- 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)
Question:- What is the physical storage length of each of the data types, DATE, TIME, and TIMESTAMP?
Answer:- The physical storage length of DATE is 4 bytes, TIME is 3 bytes, and TIMESTAMP is 10 bytes.
Question:- What is meant by DCLGEN?
Answer:- 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.
Question:- What are the contents of DCLGEN?
Answer:- 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.
Question:- What are some of the main fields in SQLCA?
Answer:- Major fields in SQLCA are SQLCODE, SQLERRM, and SQLERRD.
Question:- What is meant by EXPLAIN?
Answer:- EXPLAIN is used for displaying the access path as determined by the optimizer for SQL statements. It can also be used in the case of SPUFI for single SQL statements or in the BIND step for Embedded SQL.
Question:- How to perform EXPLAIN for any Dynamic SQL statement?
Answer:- Users can use SPUFI or QMF statements to perform EXPLAIN for Dynamic SQL statements. They can also include the EXPLAIN command in the Embedded Dynamic SQL statements.
