deallocate prepare

Description

Deallocates a dynamic SQL statement that was prepared in a prepare statement.

Syntax

exec sql [at connection_name] 
 deallocate prepare statement_name end-exec

Parameters

statement_name

The identifier assigned to the dynamic SQL statement when the statement was prepared.

Examples

Example 1

     EXEC SQL BEGIN DECLARE SECTION END-EXEC.
           01     CMDBUF         PIC X(120).
           01     STATE          PIC X(3).
      EXEC SQL END DECLARE SECTION END-EXEC.
 
              ...
           
   * The 'select into table' statement returns no results   
   * to the program, so it does not need a cursor.
 
      MOVE "select * into tmp from authors where state = ?"
                TO CMDBUF.
 
      DISPLAY "STATE ? ".
      ACCEPT STATE.
 
      EXEC SQL PREPARE dynstmt FROM :CMDBUF END-EXEC.
      EXEC SQL EXECUTE dynstmt USING :STATE END-EXEC.
 
      EXEC SQL DEALLOCATE PREPARE dynstmt END-EXEC.
      EXEC SQL COMMIT WORK END-EXEC.

Usage

WARNING! If you are using persistent binds in your Embedded SQL program, use the deallocate prepare statement carefully. Needlessly deallocating prepared statements can negate the advantage of persistent binds.

See also

declare cursor (dynamic), execute, execute immediate, prepare