-499   CURSOR cursor-name HAS ALREADY BEEN ASSIGNED TO THIS OR ANOTHER RESULT SET FROM PROCEDURE procedure-name.

Explanation

An attempt was made to assign a cursor to a result set using the SQL statement ALLOCATE CURSOR and one of the following applies:
  • The result set locator variable specified in the ALLOCATE CURSOR statement has been previously assigned to cursor cursor-name.
  • Cursor cursor-name specified in the ALLOCATE CURSOR statement has been previously assigned to a result set from stored procedure procedure-name.

System action

The statement cannot be processed.

Programmer response

Determine if the target result set named in the ALLOCATE CURSOR statement has been previously assigned to a cursor.

If the result set has been previously assigned to cursor cursor-name, then either choose another target result set or call stored procedure procedure-name again and reissue the ASSOCIATE LOCATOR and ALLOCATE CURSOR statements.

If the result set has not been previously assigned to a cursor, the cursor cursor-name specified in the ALLOCATE CURSOR statement has been previously assigned to some result set from stored procedure procedure-name. You can not assign cursor cursor-name to another result set, so you must specify a different cursor name in the ALLOCATE CURSOR statement.

Correct the statements so that the exact syntax used to specify the procedure name on the CALL statement be the same as that on the ASSOCIATE LOCATOR and/or DESCRIBE PROCEDURE. If an unqualified name is used to CALL the procedure, the 1-part name must also be used on the other statements. If the CALL statement is made with a 3-part name, and the current server is the same as the location in the 3-part name, the ASSOCIATE LOCATOR or DESCRIBE procedure can omit the location.

SQLSTATE

24516