A script-enabled browser is required for this page to function properly.

Creating a query: REF CURSOR Query tool

To create a REF CURSOR query:

  1. Create a package that defines a REF CURSOR type in one of the following ways:

  2. If the package created in Step 1 is an external PL/SQL library, you must attach it to the report before referencing it.

  3. In the Data Model view, single-click the REF CURSOR Query tool in the tool palette.

  4. Click in the main area (canvas region) of the window.  

  5. In the PL/SQL Editor, type the PL/SQL for a function that opens a cursor and returns a cursor variable of the REF CURSOR type you defined in the package. For example:

    
      
       empCur rcPackage.empCurType;
    	 
       BEGIN 
         OPEN empCur FOR SELECT * FROM emp;
         RETURN empCur;
    END; /* Note, rcPackage is a local program unit defined as: */
    PACKAGE rcPackage IS TYPE empCurType IS REF CURSOR RETURN emp%ROWTYPE; END;

    Note: Oracle Reports supports both static and dynamic REF CURSORs. For more information, see About REF CURSOR queries.

  6. Refine the query as desired:

  7. Repeat Steps 1 through 6 for each REF CURSOR query you want to create.

Next step

Creating a data link

Creating a default layout for a report

See also

About REF CURSOR queries

Creating a query

Creating a query: Data Wizard

Creating a query: SQL Query tool

Creating a query: XML Query tool

Creating a query: JDBC Query tool

Creating a query: Text Query tool

Creating a query: Express Server Query tool

Creating a query: OLAP Query tool

The chapter titled "Building a Paper Report with REF CURSORs " in the Oracle Reports Building Reports manual, available on the Oracle Technology Network Oracle Reports Documentation page (http://www.oracle.com/technology/documentation/reports.html).