Declaring a Cursor Variable v11
SPL supports the declaration of a cursor variable using both the SYS_REFCURSOR
built-in data type as well as creating a type of REF CURSOR
and then declaring a variable of that type. SYS_REFCURSOR
is a REF CURSOR
type that allows any result set to be associated with it. This is known as a weakly-typed REF CURSOR
.
Only the declaration of SYS_REFCURSOR
and user-defined REF CURSOR
variables are different. The remaining usage like opening the cursor, selecting into the cursor and closing the cursor is the same across both the cursor types. For the rest of this chapter our examples will primarily be making use of the SYS_REFCURSOR
cursors. All you need to change in the examples to make them work for user defined REF CURSORs
is the declaration section.
Note
Strongly-typed REF CURSORs
require the result set to conform to a declared number and order of fields with compatible data types and can also optionally return a result set.
declaring_a_sys_refcursor_cursor_variable declaring_a_user_defined_ref_cursor_type_variable