3. Statements : OpenROAD SQL Statements : Execute Immediate Statement
 
Share this page                  
Execute Immediate Statement
This statement executes an SQL statement.
This statement has the following syntax:
execute immediate statement_string
          [into variable{, variable}
          [beginendblock]];
The execute immediate statement performs any of the following functions:
Executes SQL statements that you cannot include directly in your 4GL script
Executes SQL statements constructed at runtime
Includes new SQL functionality in your 4GL scripts
If you do not include a statement string, a runtime error occurs when the execute immediate statement is executed.
A select statement as the value of statement_string can return one or more rows. If it returns more than one row, the select statement can contain a select loop to process the rows. A select statement executed with the execute immediate statement cannot be a repeated select.
Use the into clause when the value of statement_string is a select statement. When the select statement executes, the values it retrieves are placed in the variables named in the into clause. The number and data types of these variables must match the number and data types of the values returned by the select statement. For more information, see Select Statement (see Select Statement).