Creating a query: XML Query tool Creating a query: JDBC Query tool Creating a query: Text Query tool Creating a query: REF CURSOR Query tool

How To... 4-51

4.8.1.4 Creating a query: XML Query tool

To create an XML query:

1. In the Data Model view, single-click the XML Query tool in the tool palette.

2. Click in the main area canvas region of the window.

3. In the Define XML Query dialog box, define the XML query based on the fields

defined in the data definition file DTD selected. The query is run against the data in the XML data file. If an XSL file is specified, it translates the XML data file before running the query.

4. Click OK.

4.8.1.5 Creating a query: JDBC Query tool

To create a JDBC query: 1. In the Data Model view, single-click the JDBC Query tool in the tool palette. 2. Click in the main area canvas region of the window. 3. In the JDBC Query dialog box, define the JDBC query or procedure and the connection parameters for the data source. Click Help for assistance.

4. Click OK.

4.8.1.6 Creating a query: Text Query tool

To create a Text query:

1. In the Data Model view, single-click the Text Query tool in the tool palette.

2. Click in the main area canvas region of the window.

3. In the Define Text Query dialog box, specify the data definition and data source

for the text query. Click Help for assistance. 4. Click OK.

4.8.1.7 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: ■ Create a local program unit see Section 4.13.3.1, Creating a local program unit ■ Create an external PLSQL library see Section 4.13.5.1, Creating an external PLSQL library ■ Create a stored program unit see Section 4.13.3.2, Creating a stored program unit 2. If the package created in Step 1 is an external PLSQL 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. Note: If you define multiple queries in the Data Model view of your report, the Data page does not appear when you invoke the Report Wizard to default the layout. 4-52 Oracle Reports Users Guide to Building Reports 4. Click in the main area canvas region of the window. 5. In the PLSQL Editor, type the PLSQL 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 empROWTYPE; END; 6. Refine the query as desired: ■ Click the REF CURSOR query object, then choose Tools Property Inspector to modify properties. ■ Click the query object, then choose Tools Data Wizard to specify which fields to display, group fields, and any totals. 7. Repeat Steps 1 through 6 for each REF CURSOR query you want to create. See also Section 2.6.10, About REF CURSOR queries

4.8.2 Modifying a query