The SQL source statement contained in the host variable is prepared and executed.


Syntax

<execute statement> ::=

EXECUTE IMMEDIATE <sql-string>

<sql-string> ::= <character string literal>


Usage

The EXECUTE IMMEDIATE statement is used to execute dynamic SQL.


Notes

<sql-string> can be any valid SQL expression in text form.
<sql-string> is parsed at the time of execution
the query is prepared, executed, unprepared and released in one atomic step

Examples

1) The following example executes a simple dynamic query:

       DECLARE TableName as varchar(100);

 SET TableName = 'student';

 EXECUTE IMMEDIATE 'select * from ' + TableName;


Conformance

SQL:2003 standard

-

Dynamic SQL

Home | Site Contents | Documentation | NexusDB Manual V4 | SQL Reference | SQL Statements | Data Statements