EXECUTE IMMEDIATE
Function
The EXECUTE IMMEDIATE statement prepares and executes an SQL statement for immediate execution. After execution, the prepared statement is deleted.
Invocation
Embedded Mode P Dynamic Mode Interactive Mode
Syntax

host_variable_identifier | A valid single host variable identifier. It must have been defined in the application program according to the host language rules. The data type of the host variable must be a character string.
character_string_constant | A valid character-string constant.
EXECUTE IMMEDIATE | See Description below.

Description
The EXECUTE IMMEDIATE statement performs the following actions:
COMPILATION: The SQL statement in a character-string representation is compiled into a prepared SQL statement. If an error is encountered by the SQL compiler which prevents the SQL statement being compiled successfully, an error is passed back to the application program in the SQLCODE field of the SQLCA. In this case, no prepared statement is created and the execution phase is not entered.
EXECUTION: The prepared SQL statement is executed. If an error is encountered during the execution of the prepared statement, the error is passed back to the application program in the SQLCODE field of the SQLCA.
DELETION: The prepared SQL statement is deleted. The prepared statement is deleted after execution. This means, that even if the exact same statement will have to be executed twice with two separate EXECUTE IMMEDIATE statements within the same transaction, it will have to be compiled twice.
Limitations
The character-string must contain one of the following statements:
COMMIT, CREATE, DELETE, DROP, INSERT, ROLLBACK, or UPDATE.
Host variable markers or references are not permitted in the 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.
Example:
EXECUTE IMMEDIATE 'DELETE FROM cruise' ;