Oracle Reports
Oracle Reports
• Binary File Full report definition (includes source code and comments)
• Modifiable through Builder. Binary, executable Portable if transferred as binary.
• PL/SQL recompiles on Open/Run
.rep Report
• Object Navigator
• Property Palette
• Data Model Editor
• Layout Model Editor
• Parameter Form Editor
Object Navigator
The Object Navigator shows a hierarchical view of objects in the report. Each item listed is called a node and represents an object or type of object the
report can contain or reference.
Property Palette
A Property Palette is a window that displays the settings for defining an Oracle reports object.
Queries
Queries are SQL Select statements that fetch data from the oracle database. These statements are fired each time the report is run.
Groups
Groups determine the hierarchy of data appearing in the report and are primarily used to group columns selected in the query. Oracle report
automatically creates a group for each query.
Formula Columns
Formulas can be entered in formula columns to create computed columns. Formulas can be written using PL/SQL syntax. Formula columns are generally
preceded by CF_ to distinguish from other columns.
Summary Columns
Summary columns are used for calculating summary information like sum, average etc. This column uses a set of predefined oracle aggregate
functions. Summary columns are generally preceded by CS_ to distinguish them from other columns.
Placeholder Column
Place holder Colum’s are used to store the value of the variable.
Used to hold the values at runtime act as a global variables in reports
A ref cursor query uses PL/SQL to fetch data. Each ref cursor query is associated with a PL/SQL function that returns a strongly typed ref cursor. The
function must ensure that the ref cursor is opened and associated with a SELECT statement that has a SELECT list that matches the type of the ref
cursor.
You base a query on a ref cursor when you want to:
more easily administer SQL
avoid the use of lexical parameters in your reports
share datasources with other applications, such as Form Builder
increase control and security
encapsulate logic within a subprogram
Furthermore, if you use a stored program unit to implement ref cursors, you receive the added benefits that go along with storing your program units in
the Oracle database.
Data Links
Data links are used to establish parent-child relationships between queries and groups via column matching.
Frames
Frames surround other layout objects, enabling control of multiple objects simultaneously
Repeating Frames
Repeating frames acts as placeholders for groups (I.e repeating values) and present rows of data retrieved from the database. Repeating frames repeat
as often as the number of rows retrieved.
Fields
Fields acts as placeholders for columns values. They define the formatting attributes for all columns displayed in the report.
Boilerplate
Boilerplate consists of text (label of the column) and graphics that appear in a report each time it is run.
Parameters
Parameters are variables for a report that accept input from the user at runtime. These parameter values can then be used in the SQL select statements
to retrieve data conditionally. Oracle reports creates a set of system parameters at runtime namely report destination type, number of copies etc.
Report Wizard
• When we create a default Tabular Report using report wizard, the wizard will take you through the below mentioned pages
• Report Style Tabular, Form-Like, Mailing Label, Form Letter, Group Left, Group Above, Matrix, Matrix with Group
• Query Type Choose whether to build a SQL query or an Express query.
• Data Enter a SELECT statement to retrieve the report data
• Displayed Fields Select the fields that you want to display in the output.
• Fields to Total Select the fields that you want to summarize.
• Labels for Fields Alter the labels that appear for each field and the width of each field.
• Template Select the template that you want to use for this report. A template contains standard information such as company logo, date, and so on.
Note: The above steps are different for each report style.
The difference between Mailing Labels and Form Letters is, Mailing Label shows multiple records on one page while Form Letter shows one record on
each page.
Triggers in Reports
Types of Triggers
Formula Triggers: Formula triggers are PL/SQL functions that populate columns of type Formula.
Format Triggers: Format triggers are PL/SQL functions executed before the object is formatted. These triggers are used to dynamically change the
formatting attributes and used to conditionally print and not to print a report column value. These triggers return Boolean values TRUE or FALSE. If the
return value of the format trigger is FALSE, the value is not displayed.
Action Triggers: Action Triggers are PL/SQL procedures executed when a button is selected in the Previewer.
The trigger can be used to dynamically call another report (drill down) or execute any other PL/SQL..
Validation Triggers: Validation triggers are PL/SQL functions that are executed when a parameter value is entered and the cursor moves to the next
parameter. These triggers return Boolean value TRUE / FALSE.
Report Triggers: Report triggers enable execution of PL/SQL functions at specific time during execution and formatting of report.
Before Report
Fires before the report is executed but after the queries is parsed and date is fetched.
Between Pages
Fires before each page of the report are formatted, except the very first page. This page is used to customize page formatting.
After Report
Fires after the report previewer are exited, or after report output is sent to a specified destination.
Bind parameters
Lexical parameter
Lexical parameter is used to pass an entire where condition at
runtime.
Ex:-
select empno,ename from emp &X