Hi All,
We are facing an issue in our project with DB2 Cursors. Please find the step-by-step explanation for the same mentioned below:
Steps
1. DECLARE the cursor
2. OPEN the cursor
3. FETCH first row
4. UPDATE the retrieved row
5. INSERT a new row in the table that satisfies the SELECT criteria in the cursor declaration
6. FETCH second row
Expected result:
The inserted row should not be retrieved in FETCH statement. Since, all the rows for the cursor have already been retrieved in the OPEN statement.
Actual result:
The newly inserted row is retrieved in the second FETCH statement.
Please let me know the reason for the same. I do not think it depends on isolation level of the query. Nonetheless, the isolation level is CS. Any help would be highly appreciated.
Regards,
Rajesh