PL/SQL Ref Cursors


A REF CURSOR query uses PL/SQL to fetch data. Each REF CURSOR query is associated with a PL/SQL function that returns a cursor value from a cursor variable. The function must ensure that the REF CURSOR is opened and associated with a SELECT statement that has a SELECT list that matches the type of the REF CURSOR.

A REF CURSOR query uses PL/SQL to fetch data. Each REF CURSOR query is associated with a PL/SQL function that returns a cursor value from a cursor variable. The function must ensure that the REF CURSOR is opened and associated with a SELECT statement that has a SELECT list that matches the type of the REF CURSOR.
  • Oracle Reports supports only strongly typed REF CURSORs.
For example: type c1 is REF CURSOR RETURN emp%ROWTYPE;
  • When you make a REF CURSOR query the child in a data link, the link can only be a group to group link. It cannot be a column to column link.
  • If you use a stored program unit to implement REF CURSORs, you receive the added benefits that go along with storing your program units in the Oracle database.
  • You base a query on a REF CURSOR when you want to:
1.      more easily administer SQL.
2.      avoid the use of lexical parameters in your reports.
3.      share data sources with other applications, such as Form Builder.
4.      increase control and security.
5.      encapsulate logic within a subprogram.

Furthermore, if you use a stored program unit to implement REF CURSORs, you receive the added benefits that go along with storing your program units in the Oracle database. 


Refer the following url for detailed information: