Declaring a user-defined REF CURSOR type variable v14

You must perform two distinct declaration steps to use a user-defined REF CURSOR variable:

  • Create a referenced cursor TYPE.
  • Declare the actual cursor variable based on that TYPE.

The syntax for creating a user-defined REF CURSOR type:

TYPE <cursor_type_name> IS REF CURSOR [RETURN <return_type>];

This example shows a cursor variable declaration:

DECLARE
    TYPE emp_cur_type IS REF CURSOR RETURN emp%ROWTYPE;
    my_rec emp_cur_type;
        ...