Entering content frame

 PREPARE Statement 

Use

Use the PREPARE statement to prepare a dynamic SQL statement with parameters for execution, and assign it a statement name.

Syntax

EXEC SQL [<session_spec>] PREPARE <statement_name>
         [INTO <descriptor_name> [USING <using_clause>]]
         FROM <statement_source>;

·        Specify <session_spec>, when you are working with multiple database sessions.

·        In <statement_name>, specify the statement name either in a host variable or as a constant character string.

·        In <statement_name>, specify the dynamic SQL statement either in a host variable or as a constant character string.

In the PREPARE statement, the <descriptor_name> and the <using_clause> have no meaning in the SQL mode INTERNAL. They are used for DB2 compatibility.

 

Leaving content frame