-249   DEFINITION OF ROWSET ACCESS FOR CURSOR cursor-name IS INCONSISTENT WITH THE FETCH ORIENTATION CLAUSE clause SPECIFIED

Explanation

A clause specified for the FETCH statement is inconsistent with the definition of the cursor cursor-name. This error can be issued for the following situations:
  • A cursor defined WITHOUT ROWSET POSITIONING can only use BEFORE, AFTER, row positioned fetch orientation keywords: NEXT, PRIOR, FIRST, LAST, CURRENT, ABSOLUTE, or RELATIVE.
  • A cursor defined WITH ROWSET POSITIONING can use BEFORE, AFTER, rowset positioned fetch orientation clauses: NEXT ROWSET, PRIOR ROWSET, FIRST ROWSET, LAST ROWSET, CURRENT ROWSET, or ROWSET STARTING AT, or, row positioned fetch orientation keywords: NEXT, PRIOR, FIRST, LAST, CURRENT, ABSOLUTE, or RELATIVE.
A FOR n ROWS clause was specified on a FETCH statement, but the cursor is not defined for rowset access.

System action

The statement cannot be processed.

Programmer response

Correct the fetch orientation, remove the FOR n ROWS clause, or redefine the cursor.

SQLSTATE

24523