Entering content frame

 Dynamic SQL Statements Without Parameters 

Use

Specify dynamic SQL statements without parameters as a character string <statement_source> in a host variable in the application program. The character string itself cannot contain any other host variable.

Call the dynamic SQL statement with the EXECUTE IMMEDIATE statement.

Syntax

EXEC SQL [<session_spec>] EXECUTE IMMEDIATE <statement_source>;

Specify <session_spec> , when you are working with multiple database sessions.

 

EXEC SQL BEGIN DECLARE SECTION;

char statement [40];

EXEC SQL END DECLARE SECTION;

strcpy (statement, "INSERT HOTEL VALUES (80, 'Royal Plaza', 2000, \'Denver', 90.00)");

EXEC SQL EXECUTE IMMEDIATE :statement;

EXEC SQL EXECUTE IMMEDIATE 'COMMIT WORK';

 

Leaving content frame