Dynamic SQL is a PL programming capability that allows statements to be generated and executed during the execution of a PL program, achieving high flexibility in programming.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL mode.
The following describes the application scenarios of dynamic SQL:
Complete SQL statements cannot be determined during programming.
Required operations, such as DDL operations, are not supported by static SQL.
Notice
Generally, static SQL provides higher security and efficiency. Therefore, we recommend that you do not use dynamic SQL unless necessary.
In OceanBase Database, PL dynamic SQL supports complex data types for return values of SQL statements in the following scenarios:
- Dynamic SQL execution of
SELECTstatements - Dynamic SQL execution of DML statements
- Value assignment to an
OUTparameter in theUSINGclause of theEXECUTE IMMEDIATEstatement