Dynamic SQL is a programming feature provided by PL, allowing SQL statements to be generated and executed during the execution of a PL program. This greatly enhances the flexibility of programming.
Applicability
This content applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition does not support this feature.
Dynamic SQL is applicable in the following scenarios:
When the complete SQL statement cannot be determined during program development.
For operations that static SQL in PL cannot support, such as DDL.
Notice
Generally, static SQL provides better security and efficiency, so dynamic SQL should be used as little as possible.
OceanBase Database PL supports returning complex data types from SQL statements in the following scenarios:
- When dynamic SQL executes a
SELECTstatement. - When dynamic SQL executes a DML statement.
- When the
OUTattribute is assigned values through theUSINGclause ofEXECUTE IMMEDIATE.
