RPG (IBM i / AS/400) · DB2 SQLCODE
What does SQLCODE -906 - Cursor Disabled by a Previous Error mean in RPG (IBM i / AS/400)?
A FETCH or other operation was attempted against a cursor that SQL already disabled because an earlier statement error occurred on that same cursor, so SQL refuses further operations against it until it's reopened.
A FETCH or other operation was attempted against a cursor that SQL already disabled because an earlier statement error occurred on that same cursor, so SQL refuses further operations against it until it's reopened.
Stop processing the fetch loop as soon as a real error (not just SQLCODE 100) is detected, and CLOSE then re-OPEN the cursor before attempting to use it again.