DEALLOCATE PREPARE

The DEALLOCATE PREPARE statement destroys a dynamically-compiled statement and all other dynamically-compiled statements that directly or indirectly reference it. You can use this statement only in SQL embedded in an application program.
idmscu
The DEALLOCATE PREPARE statement destroys a dynamically-compiled statement and all other dynamically-compiled statements that directly or indirectly reference it. You can use this statement only in SQL embedded in an application program.
Authorization
None required.
Syntax
  ►►── DEALLOCATE PREPARE 
statement-name
 ───────────────────────────────────────►◄  
Parameters
  • statement-name
    Identifies the statement to be destroyed. It must identify a statement previously created using a PREPARE statement.
Usage
Effect on Dependent Statements
Upon successful execution of a DEALLOCATE PREPARE statement, the following actions have taken place:
  • The target statement is destroyed.
  • If the target statement was a
    cursor-specification
    , all cursors that reference the target statement are destroyed. If the cursors were open at the time the DEALLOCATE PREPARE statement was executed, they are first closed.
  • If any dynamically compiled positioned UPDATE or DELETE statements reference a cursor being destroyed, they too are destroyed.
Examples
Destroying a Prepared Statement
The following statement destroys the local statement named S1 and any cursors that reference the statement. It also destroys any statements that reference the cursors.
EXEC SQL   DEALLOCATE PREPARE S1 END-EXEC