

SQL Codes › SQL Return Codes -1 through -999 › -501 - INVALID CURSOR STATE (STMT - ID=aaaa)
-501 - INVALID CURSOR STATE (STMT - ID=aaaa)
Explanation
One of the following has occurred:
- You attempted to process a FETCH or CLOSE statement for a cursor which was already open.
- You attempted to process an OPEN statement for a cursor which was already open.
- You attempted to execute a FETCH when the cursor was positioned after the last row. That is, after the previous FETCH returned a 100 SQL code.
A cursor is in the open state following the successful execution of an OPEN statement and until the execution of a CLOSE, COMMIT WORK, or ROLLBACK WORK statement. Otherwise, a cursor is in the closed state.
Note: In CICS, an implied COMMIT WORK is issued at the end of the CICS transaction. The SQLSTATE that equates to this SQL return code is 24501.
User Response
Verify the following:
- The cursor is in the open state before executing a FETCH or CLOSE.
- A FETCH is not executed after a 100 SQL code is received.
- The cursor is in the closed state before executing an OPEN.
Copyright © 2014 CA.
All rights reserved.
 
|
|