solidDB Help : Programming : SQL extensions : Stored procedures : Executing SQL statements in a stored procedure : Using EXECDIRECT
  
Using EXECDIRECT
exec_direct_statement ::=
  EXEC SQL [USING (variable [, variable ...])] [CURSORNAME(variable)]
    EXECDIRECT sql_dml_or_ddl_statement |
  EXEC SQL cursor_name
    [USING (variable [, variable ...])]
    [INTO (variable [, variable ...])]
    [CURSORNAME(variable)]
    EXECDIRECT sql_dml_or_ddl_statement
For the full syntax of the CREATE PROCEDURE statement, see CREATE PROCEDURE.
The EXECDIRECT statement allows you to execute statements inside stored procedures without preparing those statements first. This reduces the amount of code required. If the statement is a cursor, you still need to close and drop the cursor; only the PREPARE statement can be skipped.
Considerations for EXECDIRECT usage:
If the statement specifies a cursor name, the cursor must be dropped with the EXEC SQL DROP statement; if a cursor name is not specified, you do not need to drop the statement.
If the statement is a fetch cursor, the INTO... clause must be specified.
If the INTO clause is specified, the cursor name must be specified; otherwise the FETCH statement is able to specify which cursor name the row should be fetched from. You can have more than one open cursor at a time.
The EXECDIRECT syntax is particularly appropriate for statements where there is no result set, and where you do not have to use any variable to specify a parameter value. For example, the following statement inserts a single row of data:
EXEC SQL EXECDIRECT INSERT INTO table1 (id, name) VALUES (1, 'Smith');
Go up to
Executing SQL statements in a stored procedure