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

About queries

Queries provide the data for your report. You create a query using the Report Wizard, Data Wizard, or manually using the query tools in the Data Model tool palette. Queries can select data from any data source (Oracle, XML, JDBC, Text, Oracle Express, Oracle OLAP, or your own data source that you can access through the pluggable data source (PDS) API). You can also use a REF CURSOR to create queries.

Single-query reports

Reports built using one query are the simplest reports. The most popular formats for single-query reports are tabular, mailing label, form letter, and break (either group above or group left). In one report, you can display one query’s data any number of times, even in different formats. You can query data without including it in the report output. This is useful for establishing relationships between multiple queries, performing calculations, and so on. The figure below shows the data of one query formatted various ways.

Formatting the same data in different ways

Notice that the last report style (group left break) seems to use an entirely different query for its date than the first three. However, the data it displays was hidden in the other reports, and vice versa. With Reports Builder, you can query data without including it in the report output. This is useful for establishing relationships between multiple queries, performing calculations, and so on.

Multiquery reports

A report may contain any number of queries. Multiquery reports are useful when you want to:

If you create a report with multiple queries, you can either leave the queries unrelated, or establish a relationship between them using a data link.

Multipart unrelated query reports

If you do not link the queries, you’ll produce a multipart unrelated query report (commonly called a master/master report). These types of reports display lists of unrelated data. For example, in the report below, one query selects products and another selects customers. Notice that there is no relationship between the products and customers.

report output

Multipart related query reports

In many reports, the data fetched for one part of the report is determined by the data fetched for another part. This is termed a ”master/detail,” or ”parent/child,” relationship, and is defined with a data link between two queries. When you run a master/detail report, each row of the master (or parent) query will cause the detail (or child) query to be executed, retrieving only matching rows.

Usage notes

Rationale

For a single-query report, Reports Builder opens only one cursor to fetch all of the master and detail records. For a two-query report, Reports Builder opens two cursors--one for each query--after appending the detail query's link to the WHERE clause of the detail query. Therefore, for each master record fetched in the master query, Reports Builder must rebind, execute, and fetch data from the detail query.

See also

Creating a query

About non-linkable queries

About pluggable data sources