Dynamic SQL Statements
Dynamic SQL has the following statements that are used exclusively in a dynamic program:
• EXECUTE IMMEDIATE
• PREPARE and EXECUTE
• DESCRIBE
In addition, all statements that support cursors (DECLARE, OPEN, FETCH, UPDATE, DELETE) have dynamic versions to support dynamically executed SELECT statements.
This section is an overview of the four statements used in dynamic programs. Detailed discussions on using these statements to execute dynamic statements can be found in
Execute a Dynamic Non-select Statement (see page
Execute a Dynamic Non-select Statement) and
Execute a Dynamic Select Statement (see page
Execute a Dynamic Select Statement). Information about the dynamic versions of the cursor statements is found in
Data Manipulation with Cursors (see page
Data Manipulation with Cursors). In addition, information about the dynamic version of the EXECUTE PROCEDURE statement is found in Execute Procedure of the chapter “SQL Statements.”