DEALLOCATE PREPARE
Function
The DEALLOCATE PREPARE statement deallocates a prepared statement by releasing all associated resources. After the successful execution of a DEALLOCATE PREPARE statement, the relevant prepared statement no longer exists and cannot be addressed anymore.
Invocation
Embedded Mode P Dynamic Mode Interactive Mode
Syntax
statement_identifier | A valid identifier used to identify the statement to be deallocated. |
host_variable_identifier | A valid single host variable identifier. It must contain the statement identifier. |
Description
The effect of a DEALLOCATE PREPARE statement is that the identified statement will be deleted.
The effect of a DEALLOCATE PREPARE statement is also achieved implicitly when an already existing prepared statement is specified in a PREPARE statement. An implicit DEALLOCATE PREPARE statement also occurs in either of the following situations:
A COMMIT or ROLLBACK is executed.
A DISCONNECT is issued to end a session.
Limitations
All cursors must be closed before executing a DEALLOCATE PREPARE statement.
ANSI Specifics
None.
CONNX Embedded SQL Specifics
This statement can be mixed with any other DML, DDL and/or DCL statements in the same transaction.
Here is an example on how to delete the prepared statement which is identified by statement_identifier:
DEALLOCATE PREPARE statement_identifier;