Declaring a User Defined REF CURSOR Type Variable v13

You must perform two distinct declaration steps in order 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 is as follows:

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

The following is an example of a cursor variable declaration.

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