-496   THE SQL STATEMENT CANNOT BE EXECUTED BECAUSE IT REFERENCES A RESULT SET THAT WAS NOT CREATED BY THE CURRENT SERVER

Explanation

The SQL statement cannot be executed because the current server is different from the server that called a stored procedure. The SQL statement can be any of the following:
  • ALLOCATE CURSOR
  • DESCRIBE CURSOR
  • FETCH (using an allocated cursor)
  • CLOSE (using an allocated cursor)

System action

The statement cannot be processed.

Programmer response

Connect to the server that called the stored procedure which created the result set before running the SQL statement that failed.

SQLSTATE

51033