The DBMS_SQL system package defines an entity called SQL cursor numbers. Since SQL cursor numbers are integers, they can be passed across call boundaries and stored.
Applicability
This content applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only the MySQL-compatible mode.
You must use DBMS_SQL to execute dynamic SQL statements if any of the following conditions is met:
The content of the
SELECTlist is known only at runtime.You only know at runtime which placeholders must be bound in
SELECTor DML statements.The stored subprogram is expected to implicitly return the query results using the
DBMS_SQL.RETURN_RESULTstored procedure (rather than via theOUT REF CURSORparameter).
The DBMS_SQL package must not be used in the following situations:
Dynamic SQL statements retrieve rows into records.
To use the SQL cursor attributes %FOUND, %ISOPEN, %NOTFOUND, or %ROWCOUNT after declaring dynamic SQL in an INSERT, UPDATE, DELETE, MERGE, or single-row SELECT statement.
For more information about the DBMS_SQL system package, see DBMS_SQL.
