EXECUTE IMMEDIATE

Performs a simple SQL execution without SQL parameters or result set.

Syntax

EXECUTE IMMEDIATE sqltext
  1. sqltext is a string expression containing the SQL statement to be executed.

Usage

The EXECUTE IMMEDIATE instruction passes an SQL statement to the database server for execution in the current database connection.

The SQL statement used by EXECUTE IMMEDIATE must be a single statement without SQL parameters and must not produce a result set.

This instruction is equivalent to PREPARE, EXECUTE and FREE done in one step.

Note: Unlike the EXECUTE instruction, EXECUTE IMMEDIATE has no USING clause (to specify SQL parameters), nor does it support an INTO clause (to fetch values into variables). When specifying a USING keyword after the string containing the SQL statement, the compiler will consider this as the USING formatting operator.

Example

MAIN
  DATABASE stores 
  EXECUTE IMMEDIATE "UPDATE tab SET col='aaa' WHERE key=345"
END MAIN