Start of change

-246   STATEMENT USING CURSOR cursor-name SPECIFIED NUMBER OF ROWS num-rows WHICH IS NOT VALID WITH dimension

Explanation

A multiple-row FETCH, MERGE, or INSERT statement is not valid in this context. The statement is invalid for one of the following reasons:
  • The specified number of rows is not greater than 0 and not less than or equal to 32767.
  • The specified number of rows is greater than the dimension of the host variable array.
  • If the statement is a multiple-row FETCH statement that is executed in a distributed environment or is executed on an accelerator, the computed maximum size of the reply data exceeds the DB2® limit. The computed maximum size of the reply data is the product of the number of rows and the maximum size of the data that is returned in a single row of the query.
cursor-name
If the SQL statement is a FETCH statement, this value is the name of the cursor that was used for the FETCH statement. If the SQL statement is not a FETCH statement, this value is the string *N. *N indicates that the cursor name is not applicable.
num-rows
The number of rows that were specified.
dimension
If the statement is not a multiple-row FETCH statement that is executed in a distributed environment, and is not a multiple-row FETCH statement that is executed on an accelerator, this value is the dimension of the array.

If the statement is a multiple-row FETCH statement that is executed in a distributed environment, or a multiple-row FETCH statement that is executed on an accelerator, this value is the string *N. *N indicates that the dimension is not applicable.

System action

The statement cannot be processed. The cursor position is unchanged.

Programmer response

Take one of the following actions:
  • Change the application to declare or allocate a host variable array that is large enough to contain the specified number of rows.
  • Change the specified number of rows to be between 1 and 32767, inclusive.
  • If the statement is a multiple-row FETCH statement that is executed in a distributed environment, or is executed on an accelerator, decrease the specified number of rows.

SQLSTATE

42873

End of change