The DBMS_SQL system package defines an entity called SQL cursor ID. An SQL cursor ID is an integer and therefore can be passed and stored across call boundaries.
Applicability
This topic applies only to OceanBase Database Enterprise Edition. OceanBase Database Community Edition provides only MySQL mode.
If any of the following conditions is met, the DBMS_SQL system package must be used to run dynamic SQL statements:
The content of the
SELECTlist is not known until running.The placeholders in the
SELECTor DML statements to be bound are not known until running.The stored subprogram is expected to implicitly return the query results by using the
DBMS_SQL.RETURN_RESULTstored procedure, rather than by using theOUT REF CURSORparameter.
Dynamic SQL statements rather than the DBMS_SQL system package must be used in the following cases:
Dynamic SQL statements retrieve rows to records.
The SQL cursor attribute
%FOUND,%ISOPEN,%NOTFOUND, or%ROWCOUNTneeds to be used after theINSERT,UPDATE,DELETE,MERGE, or single-rowSELECTstatement is used to declare a dynamic SQL statement.
For more information about the DBMS_SQL system package, see DBMS_SQL.