Declaring a cursor variable v16
SPL supports two ways of declaring a cursor variable:
- Using the
SYS_REFCURSORbuilt-in data type.
REF CURSORtype that allows any result set to be associated with it. This is known as a weakly-typed
- Creating a type of
REF CURSORand then declaring a variable of that type.
Only the declaration of
SYS_REFCURSOR and user-defined
REF CURSOR variables differ. The remaining usage, such as opening the cursor, selecting into the cursor, and closing the cursor, is the same for both the cursor types. The examples primarily make use of the
SYS_REFCURSOR cursors. To make the examples work for a user-defined
REF CURSOR, change the declaration section.
REF CURSOR requires the result set to conform to a declared number and order of fields with compatible data types. It can also optionally return a result set.