Creating a query: Report Wizard Creating a query: Data Wizard Creating a query: SQL Query tool

How To... 4-49

4.8 Work with the Data Model

This section provides procedures for the following tasks that you may perform as you work with the data model of your report: ■ Creating a query ■ Modifying a query ■ Using Query Builder ■ Selecting HTML tags from the database ■ Selecting an image from the database ■ Selecting an image URL from the database ■ Creating a break group ■ Creating a matrix cross-product group ■ Creating a data link ■ Creating or editing a formula column ■ Creating a summary column ■ Creating or editing a placeholder column

4.8.1 Creating a query

To create a query, you can use any of the following tools: ■ Report Wizard single-query reports only ■ Data Wizard ■ SQL Query tool to create a query that selects data from an Oracle relational database ■ XML Query tool to access an XML data file, if you have the DTD file ■ JDBC Query tool to access any JDBC-enabled data source ■ Text Query tool to create a query that selects data from a text pluggable data source ■ REF CURSOR Query tool to use REF CURSORs See also Section 1.7.1, About queries Section 1.7.3, About database columns

4.8.1.1 Creating a query: Report Wizard

To create a query using the Report Wizard: ■ On the Data page of the Report Wizard, enter the query statements for the type of data source previously selected. For example, if you selected the SQL Query data source, you can enter your SQL query in any of the following ways: ■ Type the SELECT statement in the Data Source definition field. ■ Click Query Builder for a graphical method of creating a query without a knowledge of SQL. 4-50 Oracle Reports Users Guide to Building Reports ■ Click Import Query to use a query that has been written by someone else or to use the text editor of your choice.

4.8.1.2 Creating a query: Data Wizard

To create a query using the Data Wizard:

1. In the Data Model view, choose Insert Query to display the Data Wizard.

2. Follow the wizard to create the first query for the data model.

3. Repeat Steps 1 and 2 for each query you want to create.

4. Modify the resulting data model in the Data Model view.

5. To re-enter the Data Wizard, do either of the following:

■ Right-click, and choose Data Wizard. ■ Click the query, then choose Edit Settings.

4.8.1.3 Creating a query: SQL Query tool

To create a SQL query: 1. In the Data Model view, click the SQL Query tool in the tool palette then click in an open area of the Data Model view to display the SQL Query Statement dialog box.

2. In the SQL Query Statement field, define a SELECT statement for the query in any

of the following ways: ■ To use Query Builder for an easy graphical method of creating a query without a knowledge of SQL, click Query Builder. ■ To import a query from a file, click Import Query. ■ To enter the SELECT statement yourself, type it in the SQL Query Statement field.

3. Click OK.

4. Refine the query using either of the following methods: ■ Right-click the query object, then choose Property Inspector to set desired properties. ■ Right-click the query object, then choose Data Wizard to specify which fields to display, group fields, and any totals. 5. Repeat Steps 1 through 5 for each query you want to create. Note: The Data Wizard does not support creating links between queries. To define parentchild query relationships, you can create a data link manually. Tip: Select the columns in the order you want them to appear in the report output. How To... 4-51

4.8.1.4 Creating a query: XML Query tool