Mega Code Archive

 
Categories / Oracle PLSQL Tutorial / Cursor
 

Creating a REF CURSOR datatype

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;