Updated on 2024-05-07 GMT+08:00

EXECUTE IMMEDIATE

Function

Immediately prepares and executes a dynamically specified SQL statement without retrieving result rows.

Syntax

EXECUTE IMMEDIATE string

Parameter Description

string

A C string or host variable that contains the SQL statement to be executed.

Example

The following is an example of executing the INSERT statement using EXECUTE IMMEDIATE and a host variable named command:
sprintf(command, "INSERT INTO test (name, amount, letter) VALUES ('db: ''r1''', 1, 'f')"); 
EXEC SQL EXECUTE IMMEDIATE :command;