Wipro Technologies*
Oracle Reports Features and Benefits
Developing and executing Reports
*
*
Oracle Reports is a tool used to build reports that dynamically
retrieve, format, and distribute information which is stored in the
database.
Its Object navigator helps you navigate among the objects in your
report
The Data Model editor lets you define the data selection query for
the report.
The Layout editor allows you to create the report layout
Report Builder Components
*
*
The Parameter Form editor allows to customize the appearance of the
Runtime Parameter Form, a window that optionally appears at runtime
and enables you to enter parameter values that affect report
execution.
The Report Editor's Live Previewer view enables you to preview and
inspect your report output page by page.
Report triggers execute PL/SQL functions at specific times during
the execution and formatting of your report.
Program units are packages, functions, or procedures that you can
reference from any PL/SQL within the current report.
Report Builder Components
Queries
Groups
Columns
Parameters
Links
Queries are SELECT statements that fetch data from a standard
database.
Groups determine the hierarchy of the data appearing in a report,
and are used primarily to create breaks.
Data Model Editor
Data Model Editor
Columns contain the data values for a report. Default report
columns corresponding to the table columns included in each query's
SELECT list are automatically created by Oracle Reports, then each
column is placed in the group associated with the query that
selected the column.
If you want to perform summaries and computations on database
column values, you can create new columns.
Parameters are variables for your report that enable you to change
selection criteria at runtime.
*
Data Model - Query
*
*
Groups are created to organize the columns in your report.
Groups can do two things: separate a query's data into sets , and
filter a query's data
There are two types of groups in Oracle Reports:
Default (created by Oracle Reports)
User-created (created by you)
Data Model – Group
*
*
A database column represents a column that is selected by the
query.
By default, Oracle Reports generate one column for each item in a
query's SELECT list, and assigns each column the data type and
width specified in the database data dictionary. The default
columns are placed in the default group.
There are two types of columns:
Default
User-created
Summaries
Formulas
Parameters
Bind References
Use a bind reference when you want the parameter to substitute only
one value at runtime. Precede a bind reference with a colon (:),
eg:
WHERE 1=1 AND PURC_ORDER.SUPPLIER_NO = :P_SUPPLIERNO
Lexical References
Use a lexical reference when you want the parameter to substitute
multiple values at runtime. Precede a lexical reference with an
ampersand (&), eg:
Select ename,Job,sal from emp &wh
The Parameters will be automatically created if not
available.
Set the value of Lexical parameters in Before report trigger as per
business requirement, eg:
If :P_PONO is NULL then
:wh := 'AND PURC_ORDER.SUPPLIER_NO ='''||:P_SUPPLIERNO||'''';
User Parameter
*
*
Data links relate the results of multiple queries.
A data link (or parent-child relationship) causes the child query
to be executed once for each instance of its parent group.
Click on the parent group and click on the data link icon.
Then click on the master column of the parent group and drag to the
corresponding column of the child group.
The link properties can be viewed as this.
*
*
*
*
Layout objects define a report's format; i.e., the positioning and
appearance of data, text, and graphics in the report output.
It has 3 sections
Main Section
Header Section
Trailer Section
In every section there is Margin where you can put fields or Boiler
plate texts.
Various Layout Objects are
A frame contains data and other report objects.
It prints only as often as the object by which it is
enclosed.
A frame is not record-related
It looks like a rectangle with two diamond shapes on both vertical
sides.
Create frames to group together objects to ensure they maintain
their relative positions during printing
It demarcates sections in your report
*
*
A repeating frame is a container for records. It prints once for
each record of the group, with which it is associated.
It looks like a rectangle with an Arrow which indicates the
direction of printing.
Layout – Repeating Frames
Across: Each instance of the repeating frame subsequent to the
first instance is printed to the right of the previous
instance
Across/Down: Each instance of the repeating frame subsequent to the
first instance is printed to the right of the previous instance
until the right margin of the page. Then Report Builder prints the
next instance below the left-most instance on the page.
Down: Each instance of the repeating frame subsequent to the first
instance is printed below the previous instance.
*
*
&Current Date
&Logical Page Number
&Total Logical Pages
*
*
Boilerplate is text, lines, or graphics not fetched by a query, yet
appearing in the report output.
Use boilerplate to customize your report, such as creating heading
pages, adding graphics, etc.
Boilerplate from Files
If you have a text or graphic file that you would like to display
as boilerplate in your report, you can:
Import the contents of the file using the Import dialog box When
you import a file, a boilerplate object is created and the contents
of the file are placed in the boilerplate object. The boilerplate
object's contents are static. They remain the same even if you
later change the contents of the file.
Link to the file Linking to a file means that the contents of the
file are pulled into the boilerplate object each time the report is
run. In this way, you can ensure that your output includes the most
recent changes to the file.
Layout –Boilerplate
*
*
The Print Condition property defines when an object is triggered to
print, relative to when its owner (parent object) prints.
Ownership is determined either by explicit or implicit anchors, or
by enclosing an object .
All :Triggers the object to print on all logical pages on which the
parent prints (e.G., Column labels that print on all pages because
they are anchored to the page)
All but first :Triggers the object to print on all but the first
logical page on which the parent prints (e.G., Page numbers that
begin on page two because they are anchored to the page)
All but last :Triggers the object to print on all but the last
logical page on which the parent prints (e.G., An end-of-page
summary that is replaced on the last report page by an
end-of-report summary)
First :Triggers the object to print on only the first logical page
on which the parent prints (e.G., Column labels that only appear
once)
Last :Triggers the object to print on only the last logical page on
which the parent prints (e.G., Summaries or group footers)
Default :Has oracle reports evaluate the object's position to
determine which of the above is most relevant
Layout – Print conditions
Page Protect
The Page Protect property causes all objects within a repeating
frame or frame to remain together on the same logical page, when
possible.
If it is impossible to keep them on the same page, Oracle Reports
will let them span multiple pages.
Format Triggers
A format trigger contains PL/SQL executed when the object is
formatted
Page Protect for a repeating frame means that Oracle Reports should
protect one record of the repeating frame.
For a frame, it means Oracle Reports should protect all enclosed
objects, including all records of any repeating frame enclosed
within the frame.
The Keep with Anchoring Object property causes the parent object to
move to the next page if its child object cannot appear with it on
the same page.
Keep with Anchoring Object uses any existing explicit anchor to
determine the parent. If there is no explicit anchor, an implicit
anchor is used.
Layout – Concepts (Contd.).
*
*
Parameter form appears at runtime in which you can override default
parameter values.
The Runtime Parameter Form is built using two report-level
objects:
Fields
Boilerplate
Parameter Form Field
Field is the actual value of the parameter that is being captured
at run time.
This has the following properties:
Name
Source
*
*
Use Parameter Form Builder to build the parameter form.
The Parameter Form Builder is the work area in which you select the
report's Runtime Parameters.
When you run a report, Oracle Reports uses the Parameter Form
editor as a template for the Runtime Parameter Form.
Fields and boilerplate appear in the Runtime Parameter Form exactly
as they appear in the Parameter Form editor.
Building a parameter form
*
*
Report triggers are PL/SQL subprograms that fire at specific times
during report execution and formatting.
Report triggers govern conditional printing.
Report triggers have PL/SQL packages that enable changing of the
format attributes of an object at run time.
Report triggers enable changing of properties such as color, style,
format mask, spacing of a field or a boilerplate text.
List of Report Triggers in the order of execution:
Before Form
After Form
Before Report
Between Pages
After Report
Report Triggers
Report Triggers
Before Form – Fires before the Runtime Parameter form is displayed.
This trigger enables accessing and changing the values of
parameters, PL/SQL global variables and report level columns.
After Form – Fires after the Runtime Parameter form is displayed.
This trigger enables accessing parameters and checking their
values. This trigger can also be used to change parameter vales or,
if an error occurs, return to the Runtime Parameter Form. Columns
from the data model are not accessible from this trigger.
Before Report – Fires before the report is executed but after
queries are parsed and data is fetched.
Between Pages – Fires before each page of the report is formatted,
except the very first page. This trigger can be used for customized
page formatting.
*
Create a PL/SQL
Report program units are packages, functions, or procedures that
you can reference from any PL/SQL within the current report.
In the Object Navigator, select the Program Units node, then select
Navigator-->Create (or the Create tool).
*
*
In the Object Navigator:
Double-click on the P icon in the subprogram under the Program
Units node.
Or, if you know what object references the PL/SQL, double-click on
the PL/SQL icon in the node that represents the object.
In the Program Unit editor, modify the text of the subprogram as
desired.
Open a PL/SQL
SRW Packages
Oracle Reports is shipped with a collection of PL/SQL constructs
called SRW (SQL Report Writer) package which contain many
functions, procedures and exceptions that can be referenced in your
libraries or reports viz.
SRW.MESSAGE(msg_number NUMBER, msg_text CHAR);
SRW.DO_SQL(sql_statement CHAR);
SRW.PROGRAM_ABORT;
SRW.RUN_REPORT(command_line CHAR);
*
*
Tabular Report
*
*
Mailing Label Report
*
*
Form letter reports contain database values embedded in boilerplate
text.
*
*
Master/Master Report
A master/master report displays at least two sets of data which are
not
directly related--that is, the records constituting the data are
fetched using
at least two separate queries
*
*
Break Report (Group Left)
*
*
Create a break report when you want to prevent a column from
repeatedly displaying the same value while other column values in
the rows change. A break report resembles a master/detail (or
parent/child) report in that one master record prints, followed by
all the detail records with which the master has something in
common.
Reset Level
*
Master/Detail Report
*
*
A matrix (cross tab) report contains one row of labels, one column
of labels, and information in a grid format that is related to the
row and column labels.
A distinguishing feature of matrix reports is that the number of
columns is not known until the data is fetched from the
database.
Matrix Report
*
*
A matrix report is a cross-tabulation of four sets of data:
One set of data is displayed across the page.
One set of data is displayed down the page.
One set of data is the cross-product, which determines all possible
locations where the across and down data relate and places a cell
in those locations.
One set of data is displayed as the "filler" of the cells.
Matrix Report
Queries
Although matrix report always require at least four groups, they
can be built with any number of queries. If you build a matrix
report with only one query (usually the most efficient structure),
you must create at least three groups manually in addition to the
one created by default.
Matrix Report
Two dimension groups.
Dimension groups are created for row and columns of the Matrix
report.
One cross product groups.
The cross product group represents all possible combinations of the
values of the dimension groups. In the layout, the cross product
group is represented by the intersection of the repeating frames
for the across and down dimension groups
One cell, or "filler" group.
The cell group contains the actual information that is represented
by the cells of the cross product.
Matrix Report
A Matrix Report Layout should contain:
At least two repeating frames, one with a print direction of down
and one with a print direction of across
A matrix object created for the cross product group, inside of
which reside the cells of the matrix
Boilerplate for each column and row of values, as well as for
summaries .
Matrix Layout