Execute Immediate
Executes an SQL statement.
Syntax
execute immediate string_expression
string_expression
Specifies a character string that contains a valid SQL statement
Description
The 4GL execute immediate statement executes an SQL statement that you specify as the value of a string expression. You cannot specify a select statement, although the statement you specify can contain a subselect.
There are several other SQL statements that you cannot use with the execute immediate statement. See the SQL Reference Guide for more information.
Examples
Define a one‑column view on the Employee table. The name of the view is stored in the varchar variable viewname, and the name of the column is stored in the varchar variable columnname.
Execute immediate 'create view ' + viewname
+ ' as select ' + columnname
+ ' from employee';