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 can, therefore, not be addressed anymore.
Embedded Mode P |
Dynamic Mode |
Interactive Mode |
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. |
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.
All cursors must be closed before executing a DEALLOCATE PREPARE statement.
None.
This statement may be mixed with any other DML, DDL and/or DCL statements in the same transaction.
Example
The following example deletes the prepared statement identified by statement_identifier.
DEALLOCATE PREPARE statement_identifier;