Try OpenEdge Now
skip to main content
SQL Reference
ESQL Reference : Embedded SQL : ESQL elements and statements : EXECUTE IMMEDIATE
 
EXECUTE IMMEDIATE
Executes the statement specified in a statement_string or host_variable.

Syntax

EXECUTE IMMEDIATE {statement_string|host_variable};

Parameters

statement_string
The character string form of the statement.
host_variable
The host variable name which passes values between the database and the application program.

Notes

*The character string form of the statement is referred to as a statement string. An EXECUTE IMMEDIATE statement accepts either a statement string or a host variable as input.
*A statement string must not contain host variable references or parameter markers.
*A statement string must not begin with EXEC SQL delimiter and must not end with a semicolon.
*When an EXECUTE IMMEDIATE statement is executed, the SQL engine parses the statement and checks it for errors. Any error in the execution of the statement is reported in the SQLCA.
*If the same SQL statement is to be executed multiple times, it is more efficient to use PREPARE and EXECUTE statements, rather than an EXECUTE IMMEDIATE statement.
* Related statement