Creating a REF CURSOR datatype : ref cursor « Cursor « Oracle PL/SQL Tutorial






The REF CURSOR datatype cannot be used outside a PL/SQL environment.

There are two kinds of REF CURSOR types: weak and strong.

A weak REF CURSOR can point to any data set, as shown here:

declare
  type weak_rcty is ref cursor;
  c_weak rcty weak_rcty;
declare
  c_weak sys_refcursor;

A strong REF CURSOR explicitly declares the type of data that can be referenced.

In the following example, only queries that return rows exactly as in the EMPLOYEE table are allowed:

declare
  type strong_rcty is ref cursor return employee%ROWTYPE;
  c_strong_rcty strong_rcty;








25.12.ref cursor
25.12.1.Create and use reference cursor
25.12.2.Creating a REF CURSOR datatype
25.12.3.Timing a ref cursor
25.12.4.REF CURSOR custom type
25.12.5.Reference cursor
25.12.6.Reference value in a cursor by cursor variable