Navigation:  NexusDB Guide > SQL Reference > SQL Statements > Data Statements >

EXECUTE IMMEDIATE statement

Previous pageReturn to chapter overviewNext page

NexusDB V3 Manual

EXECUTE IMMEDIATE statement

button_main button_prev button_next

NexusDB Manual V3 > SQL Reference > SQL Statements > Data Statements

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

 

© Nexus Database Systems Pty Ltd.

nexus_logo