Give an example of a transaction program that contains a cursor, such that the value returned by one of its FETCH statements depends on whether or not the cursor was defined to be INSENSITIVE. Give a one sentence explanation of your answer.

Assume this transaction is the only transaction executing. We are not concerned about any effect that a concurrently executing transaction might have

What will be an ideal response?


In the program below, if the cursor is INSENSITIVE, the effect of the DELETE statement will
not be seen by the FETCH statement.



#dene OK "00000"
#dene EndOfScan "02000"
EXEC SQL BEGIN DECLARE SECTION;
unsigned long stud id;
char grade[1];
char *crs code;
char *semester;
char SQLSTATE[6];
EXEC SQL END DECLARE SECTION;
EXEC SQL DECLARE GetEnrolled INSENSITIVE CURSOR FOR
SELECT T.StudId, T.Grade
FROM Transcript T
WHERE T.CrsCode = :crs code
AND T.Semester =:semester
FOR READ ONLY;
EXEC SQL OPEN GetEnrolled;
EXEC SQL DELETE FROM Transcript
WHERE CrsCode IN (:crs code);
EXEC SQL FETCH GetEnrolled INTO :stud id, :grade;
while (strcmp(SQLSTATE,OK) == 0) {
: : : process the values in stud id and grade : : :
EXEC SQL FETCH GetEnrolled INTO :stud id, :grade;
}
EXEC SQL CLOSE GetEnrolled;

Computer Science & Information Technology

You might also like to view...

Microsoft Outlook uses a special file format called a ____ to save your email files, calendar entries, and contacts.

A. Sensitivity level B. mailbox C. data file D. personal storage table

Computer Science & Information Technology

Hexadecimal uses the symbols 1, 2, 3, 4, 5, 6, 7 8, 9, A, B, C, D, E, F ,G.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

In Stat TDM, the ____________________, provides information that the receiving multiplexor canĀ use to detect transmission errors within the frame.?

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

This measurement is the default text inset for a cell.

A. .25" B. .125" C. 0" D. .0556"

Computer Science & Information Technology