EXECUTE IMMEDIATE

Prepares and executes a dynamically submitted SQL statement.

execute_immediate.png

 

Usage

Embedded/Module.

Description

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

For a fuller discussion of the use of EXECUTE statements in dynamic application programs, see the Mimer SQL Programmer's Manual, Dynamic SQL.

Restrictions

The EXECUTE IMMEDIATE statement may only be used for dynamically submitted statements with no parameter markers.

Dynamically submitted SELECT statements may not be executed with EXECUTE IMMEDIATE, these should be performed using a sequence of OPEN, FETCH and CLOSE statements.

Note:You can use singleton SELECT statements or calls to result set procedures if the result set will contain only one row.

Example

strcpy(sqlstr,"DELETE FROM sometable WHERE id IS NULL");

exec sql EXECUTE IMMEDIATE :sqlstr;

 

For more information, see the Mimer SQL Programmer's Manual, Executable Statements.

Standard Compliance

Standard

Compliance

Comments

SQL-2016

Features outside core

Feature B031, “Basic dynamic SQL”.