21) Why SELECT * is not preferred in embedded SQL programs?
For three reasons:
If the table structure is changed ( a field is added ), the program will have
to be modified
Program might retrieve the columns which it might not use, leading on I/O
over head.
The chance of an index only scan is lost.
What are correlated subqueries? -
A subquery in which the inner ( nested ) query refers back to the table in
the outer query. Correlated subqueries must be evaluated for each qualified row
of the outer query that is referred to.
22) What are the issues related with correlated subqueries? –
???
23) What is a cursor? why should it be used? –
Cursor is a programming device that allows the SELECT to find a set of rows
but return them one at a time.
Cursor should be used because the host language can deal with only one row at
a time.
24) How would you retrieve rows from a DB2 table in embedded SQL? –
Either by using the single row SELECT statements, or by using the CURSOR.
Apart from cursor, what other ways are available to you to retrieve a row
from a table in embedded SQL? -
Single row SELECTs.
25) Where would you specify the DECLARE CURSOR statement? –
See answer to next question.
|