You can execute SQL statements dynamically in either prepared or immediate form, as described in the following table.
Stored procedures only support the immediate form of dynamic SQL.
Dynamic SQL Statement Type | Description |
---|---|
Prepared | Valid statement text is prepared and preserved for the duration of the session and the statement can be executed as many times as the application requires. There is some overhead in preparing an SQL statement, somewhat similar to the overhead required to compile and preprocess static SQL for an embedded SQL application. |
Immediate | Valid statement text is executed one time only. If a statement must be executed more than one time in an application, then you must incur the overhead of preparing and performing it each time. |
Related Topics
For more information about:
- Stored procedures and dynamic SQL, see Using Dynamic SQL in Stored Procedures.
- Preparing dynamic SQL statements in embedded SQL applications, see EXECUTE (Dynamic SQL Form) and PREPARE.
- Preparing and executing dynamic SQL statements in embedded SQL applications, see EXECUTE IMMEDIATE.