Embedded SQL
DB2 SQL CURSOR : COMMITMENT CONTROL
When you use COMMIT or ROLLBACK statements with CURSOR, the behavior of the CURSOR depends on whether or not it is declared using the WITH HOLD clause If the CURSOR is declared using the WITHOUT HOLD clause, all of its resources (cursor, locks, and large-object datatype, or LOB, locators) are released upon either COMMIT or [...]
DB2 SQL CURSOR : POSITIONED UPDATE & DELETE
When processing a CURSOR, DB2 SQL give option to update or delete data in base table based on current position of CURSOR in result table. This is called POSITIONED UPDATE or POSITIONED DELETE. Let say there is a table EXAMPLETABLE like CREATE TABLE EXAMPLETABLE (id numeric, name char(10), processedFlag char(1));
DB2 SQL CURSOR : SCROLLABLE CURSOR
A scrollable cursor is one defined with the SCROLL keyword. A scrollable cursor can move in both forward and backward directions. For a scrollable cursor, each row of the result table can be fetched multiple times per OPEN of the cursor. When the cursor is opened, it is positioned before the first row in the result table. Example
DB2 SQL CURSOR : SERIAL CURSOR
SERIAL CURSOR : A serial cursor is one defined without the SCROLL keyword. A serial cursor can only more in forward direction. For a serial cursor, each row of the result table can be fetched only once per OPEN of the cursor. To use a serial cursor again, you must first close the cursor and then re-issue the OPEN statement. When the [...]
DB2 SQL CURSOR : BASIC
SQL CURSORS Result Set of a SELECT Statement which returns more than one row is easy to view on SQL interface like STRSQL. But How we can handle this result set pragmatically in Embedded SQL or SQL/PL code? Answer is SQL CURSOR. CURSOR provides a simple way to access Result Set returned by SELECT Statement. You can think of CURSOR as a [...]