11.When the LIKE statement is used?
LIKE statement is used to conduct partial searches like the search of employees by name. It is not necessary to indicate the complete name, the partial string matches would do.
12.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 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 index only scan is also eliminated.
13.What is a CURSOR and what is its use?
A CURSOR is programming device that helps the SELECT to find out set of rows but displays them one at a time. Since 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 form DB2 table embedded SQL can be retrieved using the single row SELECT statement. Another way is using the CURSOR. However, the first process is the preferred one.
15.What is the result of OPEN CURSOR statement?
In simple OPEN CURSOR statement the CURSOR is placed on the first row of the table. On the other hand, if 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 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 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 DeClarations 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?
The contents of DCLGEN are EXEC SQL DECLARE TABLE statement that gives the layout of the table/view in terms of the DB2 data types. It can also be defined as the host language copy book giving host variable definitions for the column names.