A data link (or parent-child relationship) relates the results of multiple queries. A data link can establish these relationships:
between one querys column and another querys column
between one querys group and another querys group (this is useful when you want the child query to know about its parents data)
A data link causes the child query to be executed once for each instance of its parent group. The child query is executed with the values of the primary key used by the parent.
When a report with a data link is executed, the data link is converted into a SQL clause (as specified in the link's Property Inspector) and appended to the child query if Reports Builder is able to parse the query.
Important note: If the query cannot be parsed, the query is not modified (for example, Reports Builder has no way to modify how the data is fetched when the query is defined for a pluggable data source).
Although links are commonly equijoins (for example, WHERE DEPTNO=DEPTNO
),
you can create links with various SQL clauses (that is, WHERE
, HAVING
,
or START WITH
) and conditions. If your database has database constraints,
you can create a data link that derives its SQL clause and condition from the
constraints. You can view the SELECT
statements for the individual
parent and child queries in Reports Builder, but nondefault view the SELECT
statement that includes the clause created by the data link you define.
For the report below, the following link was defined:
The default group of the master query (containing the columns Order ID
and Customer
) is the parent group; the detail query (the query
to which Item
, Product
, and Amount
belong)
is the child query.
Note: Reports Builder does not support data links between
queries that contain column objects. If you attempt to create such a
link, a message dialog box displays, which enables you to choose whether to
create a group-to-group query instead (using the parent groups), or to cancel
the operation. If you want to create a link between any type of column
and a column object, you can manually modify the SQL statement in the child
query, adding in the appropriate WHERE
clause based on columns
in the master query.
Copyright © 1984, 2005, Oracle. All rights reserved.