-518 THE EXECUTE STATEMENT DOES NOT IDENTIFY A VALID PREPARED STATEMENT

Explanation

One of the following conditions exists:
  • The statement identified in the EXECUTE statement has not been prepared.
  • The statement identified in the EXECUTE statement identifies a SELECT, or ASSOCIATE LOCATORS statement
  • The statement identified in the EXECUTE IMMEDIATE statement identifies a SELECT or ASSOCIATE LOCATORS statement.
  • The statement identified in the EXECUTE statement is a data definition statement written in native SQL language, and that statement has already been executed.
  • Start of changeA COMMIT or ROLLBACK statement was issued. The COMMIT or ROLLBACK operation destroyed the prepared version of the statement.End of change

System action

The statement cannot be processed.

Programmer response

Ensure that you prepare the statement prior to EXECUTE. Also, ensure that the statement prepared statement is not:
  • A SELECT statement.
  • An ASSOCIATE LOCATORS statement.

If the statement is a data definition statement written in native SQL language and that statement has already been executed, you must prepare the statement again before it can be executed again.

Start of changeIf the prepared statement is issued after a COMMIT or ROLLBACK statement, take one of the following actions:
  • Prepare the statement again.
  • Bind the application package with the KEEPDYNAMIC(YES) option to keep the prepared statement after a COMMIT or ROLLBACK statement.
  • Bind the application package with RELEASE(DEALLOCATE) to keep a prepared statement that references declared temporary tables after a COMMIT statement.
End of change

SQLSTATE

07003