In this post, you’ll learn about the error message +231 current position of cursor cursor-name is not valid for the specified fetch orientation of the current row or rowset in the IBM DB2 database , the reason why it occurs along with the solution to fix it
IBM DB2 Error Message
+231 current position of cursor cursor-name is not valid for the specified fetch orientation of the current row or rowset
Reason for the Error
The� cursor was not positioned on a row or rowset, and one of the following fetch orientations specified that the cursor was to be positioned relative to its current position:
1. CURRENT or CURRENT ROWSET
2. RELATIVE 0 or ROWSET STARTING AT RELATIVE 0
Solution
Correct the application program to establish a valid cursor position before issuing this FETCH statement. Be certain to FETCH to position on a row after opening a cursor. If cursor is declared SENSITIVE STATIC SCROLL, the row may be a hole, from which no values can be fetched.