You are on page 1of 402

Oracle Developer: Build

Reports

Volume 2 • Student Guide


.......................................................................................

43212GC10
Production 1.0
April 1999
M08693
Authors Copyright  Oracle Corporation, 1999. All rights reserved.

This documentation contains proprietary information of Oracle Corporation. It is


Christian Bauwens
provided under a license agreement containing restrictions on use and disclosure
Ursula Hovy and is also protected by copyright law. Reverse engineering of the software is
prohibited. If this documentation is delivered to a U.S. Government Agency of the
Department of Defense, then it is delivered with Restricted Rights and the
following legend is applicable:

Technical Reviewers
Restricted Rights Legend
Gunnar Boehrs Use, duplication or disclosure by the Government is subject to restrictions for
Jackie Bruce commercial computer software and shall be deemed to be Restricted Rights
software under Federal law, as set forth in subparagraph (c) (1) (ii) of DFARS
Ruth Delaney 252.227-7013, Rights in Technical Data and Computer Software (October 1988).
Laurent Dereac
This material or any portion of it may not be copied in any form or by any means
Astrid Dietrich without the express prior written permission of Oracle Corporation. Any other
Brian Fry copying is a violation of copyright law and may result in civil and/or criminal
penalties.
Mary Lee
Stella Misiulis If this documentation is delivered to a U.S. Government Agency not within the
Department of Defense, then it is delivered with “Restricted Rights,” as defined in
Paul Narth FAR 52.227-14, Rights in Data-General, including Alternate III (June 1987).
Sergiy Pechersky
The information in this document is subject to change without notice. If you find
Raza Siddiqui any problems in the documentation, please report them in writing to Education
John Walsh Products, Oracle Corporation, 500 Oracle Parkway, Box SB-6, Redwood Shores,
CA 94065. Oracle Corporation does not warrant that this document is error-free.

All references to Oracle and Oracle products are trademarks or registered


trademarks of Oracle Corporation.
Publisher All other products or company names are used for identification purposes only
Sherry Polm and may be trademarks of their respective owners.
Contents
.....................................................................................................................................................

Preface
Profile xv
Related Publications xvi
Typographic Conventions xvii

Introduction
Overview I-3
Course Objectives I-5
Course Content I-7

Lesson 1: Introduction to Oracle Reports


Overview 1-3
What Is Oracle Developer? 1-5
Introducing the Oracle Developer Release 6.0 Components 1-9
Report Builder Components 1-13
Getting Started in the Oracle Reports Interface 1-17
Navigating Around the Oracle Reports Main Menu 1-19
Customizing Your Oracle Reports Session 1-21
Oracle Reports Environment Variables 1-25
Oracle Reports Help Options 1-27
Introducing the Course Application 1-29
Summary 1-31
Practice Session Overview: Lesson 1 1-33
Practice Session: Lesson 1 1-34

Lesson 2: Designing and Running Reports


Overview 2-3
Designing Reports 2-5
Design Considerations 2-7
Retrieving and Sharing Data 2-15
Running a Report 2-17
Viewing the Report Output 2-19
Summary 2-29
Practice Session Overview: Lesson 2 2-31
Practice Session: Lesson 2 2-32

.....................................................................................................................................................
Oracle Developer: Build Reports iii
Contents
.....................................................................................................................................................

Lesson 3: Report Builder Concepts


Overview 3-3
Report Executables 3-5
Report Builder Components 3-9
Object Categories 3-13
Summary 3-23
Practice Session Overview: Lesson 3 3-25
Practice Session: Lesson 3 3-26

Lesson 4: Creating Reports Using the Report Wizard


Overview 4-3
Invoking Report Builder and the Report Wizard 4-5
Creating a Tabular Report Using the Wizard 4-7
Creating Other Report Styles 4-23
Summary 4-33
Practice Session Overview: Lesson 4 4-35
Practice Session: Lesson 4 4-36

Lesson 5: Enhancing Reports in the Live Previewer


Overview 5-3
What Is the Live Previewer? 5-5
Modifying a Report in the Live Previewer 5-7
Summary 5-22
Practice Session Overview: Lesson 5 5-24
Practice Session: Lesson 5 5-25

Lesson 6: Managing Report Templates


Overview 6-3
Using the Report Templates 6-5
Modifying a Template 6-7
Predefining Your Own Templates 6-13
Summary 6-17
Practice Session Overview: Lesson 6 6-19
Practice Session: Lesson 6 6-20

.....................................................................................................................................................
iv Oracle Developer: Build Reports
Contents
.....................................................................................................................................................

Lesson 7: Report Storage Methods


Overview 7-3
Storage Methods and Requirements 7-5
Documenting Your Reports 7-9
File Portability 7-11
Converting Report Definitions 7-15
Migrating Reports from Previous Releases 7-17
Summary 7-19
Practice Session Overview: Lesson 7 7-21
Practice Session: Lesson 7 7-22

Lesson 8: Enhancing Reports Using the Data Model: Creating Queries


and Groups
Overview 8-3
Describing the Report Data Model 8-5
Modifying Properties of a Query 8-7
Changing the Group Structure 8-13
The Group Hierarchy 8-15
Ordering Data in a Group Hierarchy 8-17
Filtering Data in a Group 8-21
Adding New Data 8-23
8-27
Oracle8 Objects in Report Builder 8-30
Using Data Links to Structure Data 8-36
Efficiency Issues: Multiple- or Single-Query Hierarchy 8-42
Summary 8-44
Practice Session Overview: Lesson 8 8-46
Practice Session: Lesson 8 8-47

Lesson 9: Enhancing Reports Using the Data Model: Creating Columns


Overview 9-3
The Data Model Column Types 9-5
Maintaining Database Columns 9-7
Using a Database Column to Output Contents of a File 9-9

.....................................................................................................................................................
Oracle Developer: Build Reports v
Contents
.....................................................................................................................................................

Creating a Column 9-11


Creating Summary Columns 9-13
Example Report Displaying Subtotals 9-15
Example Report Displaying Percentages 9-17
Creating Formula Columns 9-21
Creating Placeholder Columns 9-23
Example Report to Populate a Placeholder 9-25
Summary 9-27
Practice Session Overview: Lesson 9 9-29
Practice Session: Lesson 9 9-30

Lesson 10: Enhancing Reports Using the Layout Model


Overview 10-3
Viewing the Layout Model Regions 10-5
Viewing the Report Sections in the Layout Model 10-7
Designing Multipanel Reports 10-9
The Layout Model Layers 10-13
Creating Layout Objects 10-19
The Layout Model Tools 10-21
Creating Additional Layouts in a Report 10-23
Creating Variable Length Lines 10-25
Displaying a Multimedia File from a Button 10-27
Creating Explicit Anchors 10-29
Summary 10-33
Practice Session Overview: Lesson 10 10-35
Practice Session: Lesson 10 10-36

Lesson 11: Modifying Properties


Overview 11-3
Modifying Layout Object Properties 11-5
Displaying File Contents with a Link File 11-7
Modifying Common Layout Properties 11-13
Sizing Objects 11-15
Layout Object Relationships 11-17

.....................................................................................................................................................
vi Oracle Developer: Build Reports
Contents
.....................................................................................................................................................

Modifying Properties of a Field 11-29


Modifying Properties of a Repeating Frame 11-37
Summary 11-43
Practice Session Overview: Lesson 11 11-45
Practice Session: Lesson 11 11-46

Lesson 12: Creating and Using Report Parameters


Overview 12-3
Creating User Parameters 12-5
Referencing Parameters in a Report Query 12-7
Hints and Tips for Referencing Parameters 12-13
Creating a List of Values 12-15
Referencing System Parameters 12-19
Building a Parameter Form 12-23
Summary 12-27
Practice Session Overview: Lesson 12 12-29
Practice Session: Lesson 12 12-30

Lesson 13: Embedding a Chart in a Report


Overview 13-3
Creating and Embedding a Graphics Chart in a Report 13-5
Embedding an Existing Chart in a Report 13-9
Summary 13-11
Practice Session Overview: Lesson 13 13-13
Practice Session: Lesson 13 13-14

Lesson 14: Enhancing Matrix Reports


Overview 14-3
The Matrix Data Model 14-5
Matrix Layout 14-7
Creating Matrix Summaries 14-9
Building a Nested Matrix 14-11
Summary 14-19
Practice Session Overview: Lesson 14 14-21
Practice Session: Lesson 14 14-22

.....................................................................................................................................................
Oracle Developer: Build Reports vii
Contents
.....................................................................................................................................................

Lesson 15: Coding PL/SQL Triggers in Reports


Overview 15-3
Types of Triggers in Reports 15-5
Using Report Triggers 15-7
Using Data Model Triggers 15-11
Using Layout Model Triggers 15-15
Writing Common Code 15-27
Summary 15-29
Practice Session Overview: Lesson 15 15-31
Practice Session: Lesson 15 15-32

Lesson 16: Using the Report Builder Built-In Package


Overview 16-3
Contents of the Report Builder Built-in Package 16-5
Outputting Messages 16-7
Executing a Nested Report 16-9
Restricting Data 16-15
Initializing Fields 16-17
Performing DDL Statements 16-19
Setting Format Attributes 16-21
Summary 16-25
Practice Session Overview: Lesson 16 16-27
Practice Session: Lesson 16 16-28

Lesson 17: Maximizing Performance Using the Reports Server


Overview 17-3
Why Use a Remote Server? 17-5
Reports Server Architecture and Configuration 17-9
Reports Server Clustering 17-11
Viewing and Scheduling Reports in the Queue Manager 17-25
Summary 17-33
Practice Session Overview: Lesson 17 17-35
Practice Session: Lesson 17 17-36

.....................................................................................................................................................
viii Oracle Developer: Build Reports
Contents
.....................................................................................................................................................

Lesson 18: Building Reports for Different Environments


Overview 18-3
Different Development and Run-Time Environments 18-5
Developing Reports to Run in Different GUIs 18-7
Building Character Mode Reports 18-9
Building Reports to Run in Different Languages 18-13
Summary 18-17

Appendix A: Solutions
Practice Session Overview: Lesson 1 A-2
Practice Session Solutions: Lesson 1 A-3
Practice Session Overview: Lesson 2 A-8
Practice Session Solutions: Lesson 2 A-9
Practice Session Overview: Lesson 3 A-14
Practice Session Solutions: Lesson 3 A-15
Practice Session Overview: Lesson 4 A-18
Practice Session Solutions: Lesson 4 A-19
Practice Session Overview: Lesson 5 A-24
Practice Session Solutions: Lesson 5 A-25
Practice Session Overview: Lesson 6 A-30
Practice Session Solutions: Lesson 6 A-31
Practice Session Overview: Lesson 7 A-34
Practice Session Solutions: Lesson 7 A-35
Practice Session Overview: Lesson 8 A-37
Practice Session Solutions: Lesson 8 A-38
Practice Session Overview: Lesson 9 A-44
Practice Session Solutions: Lesson 9 A-45
Practice Session Overview: Lesson 10 A-51
Practice Session Solutions: Lesson 10 A-52
Practice Session Overview: Lesson 11 A-57
Practice Session Solutions: Lesson 11 A-58
Practice Session Overview: Lesson 12 A-61
Practice Session Solutions: Lesson 12 A-62

.....................................................................................................................................................
Oracle Developer: Build Reports ix
Contents
.....................................................................................................................................................

Practice Session Overview: Lesson 13 A-65


Practice Session Solutions: Lesson 13 A-66
Practice Session Overview: Lesson 14 A-69
Practice Session Solutions: Lesson 14 A-70
Practice Session Overview: Lesson 15 A-75
Practice Session Solutions: Lesson 15 A-76
Practice Session Overview: Lesson 16 A-81
Practice Session Solutions: Lesson 16 A-82
Practice Session Overview: Lesson 17 A-90
Practice Session Solutions: Lesson 17 A-91

Appendix B: Table Descriptions and Data


Summit Sporting Goods Database Diagram B-2
S_CUSTOMER Description B-3
S_CUSTOMER Data B-4
S_DEPT Description and Data B-8
S_EMP Description B-9
S_EMP Data B-10
S_ITEM Description B-13
S_ITEM Data B-14
S_ORD Description and Data B-16
S_PRODUCT Description B-17
S_PRODUCT Data B-18
S_REGION Description and Data B-22
S_TITLE Description and Data B-23
Oracle8 Objects: Types, Tables B-24

Appendix C: Frequently Asked Questions


Frequently Asked Questions C-2
Frequently Asked Questions and Answers C-3

Appendix D: Oracle Rdb Overview


What Is Oracle Rdb? D-2

.....................................................................................................................................................
x Oracle Developer: Build Reports
Contents
.....................................................................................................................................................

Appendix E: Introduction to Query Builder


What Is Query Builder? E-3
The Query Builder Window E-7
Building a New Query E-9
Datasource Components E-11
Refining a Query E-13
Viewing and Saving Queries E-17
Including Additional Tables E-19
Relationships E-23
Selecting Rows with Conditions E-29
Operators E-31
Entering Multiple Conditions E-33
Changing Conditions E-35
Defining Columns Using an Expression E-37
Defining Columns Using a Function E-39

Appendix F: Object Features in


Oracle Developer
Overview F-3
New Oracle8 Datatypes F-5
Creating Oracle8 Objects F-11
Referencing Objects F-19
Displaying Oracle8 Objects in the Object Navigator F-21
Summary F-29

Appendix G: Using the Layout Editor in Oracle Developer


Overview G-3
Why Use the Layout Editor? G-5
How to Access the Layout Editor G-7
The Layout Editor Components G-9
Creating and Modifying Objects in the Layout G-11
Formatting Objects in the Layout G-19
Coloring Objects and Text G-21
Importing Images and Drawings G-25
Summary G-27

.....................................................................................................................................................
Oracle Developer: Build Reports xi
Contents
.....................................................................................................................................................

.....................................................................................................................................................
xii Oracle Developer: Build Reports
14
................................

Enhancing Matrix Reports


Lesson 14: Enhancing Matrix Reports
......................................................................................................................................................

Objectives

At the end of this lesson, you should be


able to do the following:
• Describe the matrix Data Model objects
• Describe the matrix Layout objects
• Create and modify matrix summaries
• Display zeros in cells with no value

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
14-2 Oracle Developer: Build Reports
Overview
......................................................................................................................................................

Overview
Introduction
Matrix or cross product reports show cells of information that relate to values
appearing across the top and down the left side of the report.
In an earlier lesson you created a matrix report and matrix with group report using the
Report wizard.
In this lesson, you modify the data model and layout objects to enhance your matrix
reports.

Objectives
At the end of this lesson, you should be able to do the following:
• Design a matrix Data Model
• Design a matrix Layout Model
• Modify a matrix structure
• Create additional matrix summaries
• Display zeros in cells with no value

......................................................................................................................................................
Oracle Developer: Build Reports 14-3
Lesson 14: Enhancing Matrix Reports
......................................................................................................................................................

The Matrix Data Model

1 4
5

3
Copyright  Oracle Corporation, 1999. All rights reserved.

1 Cross product group 4 Cell column is the source of a


cross product summary that
becomes the cell content
2 Row and Column groups 5 Row and Column summaries
3 Cell group

......................................................................................................................................................
14-4 Oracle Developer: Build Reports
The Matrix Data Model
......................................................................................................................................................

The Matrix Data Model


Introduction
To maintain and enhance the structure of a matrix report, you must understand the
Data Model objects and their interdependency.

What Does the Wizard Create?


The Data Model opposite is the matrix report created in an earlier lesson. It
demonstrates the structure of the Matrix and Matrix with Group styles.

Simple Matrix Style The wizard creates three data groups:


• Department records (the rows)
• Job Title records (the columns)
• Salary records (the values used to calculate the matrix cells)
There is an extra group that surrounds the row and column groups. It is called the cross
product group and contains the summary column that forms each cell value,
SumSalary, as well as the summaries to total the row and column values.
To create a cross product group, use the Cross Product tool in the vertical toolbar.

Matrix with Group The data model is identical, except for the addition of a break
group, similar to a master/detail hierarchy.
The break group exists one level above, and outside, the matrix group. The entire cross
product group, with its contents, repeats for each record in the break group.

......................................................................................................................................................
Oracle Developer: Build Reports 14-5
Lesson 14: Enhancing Matrix Reports
......................................................................................................................................................

The Matrix Layout

1 2 3 4
Copyright  Oracle Corporation, 1999. All rights reserved.

1 Repeating frame for rows 3 Matrix object, the


(Down Direction) intersection of the two
repeating frames
2 Repeating frame for 4 Matrix with Group style: Outer
columns (Across) repeating frame for break
group

......................................................................................................................................................
14-6 Oracle Developer: Build Reports
Matrix Layout
......................................................................................................................................................

Matrix Layout
Introduction
Although the supplied templates create good-looking, professional report output, they
do not help to explain the layout objects in a classroom environment. The number of
objects and their interdependency are more complex in matrix reports than in the other
styles covered so far.
This section explains the objects by showing an expanded layout where each outer
object is slightly larger than its contents.

What Does the Wizard Create?


The layout for a Matrix report is more complex than other styles because of the special
relationship between the row and column groups and the cell values.

Simple Matrix Style The wizard creates the following objects:


• One repeating frame with Print Direction of Down to hold the row values
• One repeating framewith Print Direction of Across to hold the column values
• A field for the summary of the cell values; the source is SumSalary, which
resides in the cross product group
• Fields for the row and column values, as well as for the row, column, and report
summaries if applicable
• A matrix object that corresponds to the cross product group; this object
intersects the row and column repeating frames, and contains the cell field

Matrix with Group The Matrix with Group style is identical except for the addition
of a repeating frame that surrounds the entire matrix layout and corresponds to the
break group in the Data Model.

......................................................................................................................................................
Oracle Developer: Build Reports 14-7
Lesson 14: Enhancing Matrix Reports
......................................................................................................................................................

Creating Matrix Summaries


1 2

3
Copyright  Oracle Corporation, 1999. All rights reserved.

1 Product Order = G_DEPT 3 Product Order =


G_DEPT G_TITLE
2 Product Order = G_TITLE

......................................................................................................................................................
14-8 Oracle Developer: Build Reports
Creating Matrix Summaries
......................................................................................................................................................

Creating Matrix Summaries


Introduction
When creating row or column summaries, or the summary for the cell values, use the
summary tool in the vertical toolbar, but ensure that you create the summaries inside
the cross product group (but outside the row and column groups).
This section discusses an extra property that applies only to cross product summaries,
the Product Order property.

Setting the Product Order


The wizard sets a sensible default for this property. You do not need to alter the setting,
but you need to understand this property if you create complex matrix reports, or add
columns to an existing matrix report.
The product order defines the order in which Report Builder evaluates the groups in
the cross product for a summary.
Product Order also defines the frequency of a summary, formula, or placeholder
column in a cross product group. That is, the column has one value for each
combination of values in its Product Order groups.
The Product Order list of values provides all possible group combinations.
In the matrix report:
• F_SumSalPerDEPT has one value for each department (G_DEPT)
• F_SumSalPerTITLE has one value for each job title (G_TITLE)
• F_SumSALARY, the matrix cell, has one value for each combination of
G_DEPT and G_TITLE, so the Product Order is G_DEPT G_TITLE.

Source Column Reset At Product Order


F_SumSALPerDEPT_NAME G_DEPT G_DEPT
F_Sum_SALPerTITLE G_TITLE G_TITLE
F_SumSALARY G_TITLE G_DEPT G_TITLE

The Reset At option has the same effect as in other report styles. When you create
summaries with the wizard, each summary resets for each occurrence of the group. For
example, the department summary resets for each department. If you want the
summary values to accumulate throughout the report, change Reset At to a higher
level, such as Report.

......................................................................................................................................................
Oracle Developer: Build Reports 14-9
Lesson 14: Enhancing Matrix Reports
......................................................................................................................................................

Building a Nested Matrix

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
14-10 Oracle Developer: Build Reports
Building a Nested Matrix
......................................................................................................................................................

Building a Nested Matrix


Introduction
The nested matrix style, which you created with the wizard by adding an extra level in
the Rows tab, has some specific features. This section briefly describes the Data
Model and Layout Model, pointing out the differences from the Matrix with Group
style. It also explains how summaries evaluate the extra group level of a nested matrix.

What Is in the Nested Matrix Data Model?


The wizard creates the same objects as for a simple matrix structure. In addition, it
creates an additional break group for each level of nesting.
The cross product group encloses the additional break groups as well as the two
original dimension groups of the rows and columns.

Creating the Cross Product Group


If you enhance the existing Data Model to include an additional level of nesting, the
existing cross product group does not recognize any newly created group. You must
create the cross product group after you create all the groups that you want in the
nested matrix.

How to Recreate the Cross Product Group


1 Delete the existing cross product group.
Note: The cross product summaries are automatically deleted.
2 Create the new groups that you need.
3 Recreate the cross product group. Use the cross product tool (AxB) to click and
drag a region surrounding the break groups and the two dimension groups (rows
and columns).
4 Use the reenterable wizard to recreate the summaries.

Differences Between a Nested Matrix and a Matrix with Group


• Matrix with Group Data Model: The cross product group is the child of a parent
break group at a level above and outside the cross product.
• Nested Matrix Data Model: The cross product contains three or more groups:
one or more levels of break group and two dimensional groups to form rows and
columns.
Note: You can mix these styles. That is, you can create a Matrix with Group report
where the matrix has several nested levels within it.

......................................................................................................................................................
Oracle Developer: Build Reports 14-11
Lesson 14: Enhancing Matrix Reports
......................................................................................................................................................

Nested Matrix Layout

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
14-12 Oracle Developer: Build Reports
Building a Nested Matrix
......................................................................................................................................................

What Is in the Nested Matrix Layout Model?


The wizard creates the same objects as for a simple matrix structure. It also creates the
following objects:
• One repeating frame for each additional break group, nested within the same
overall matrix structure
• One matrix object for each additional break group
The exact appearance depends on whether the extra level is in the Row or in the
Column tab. The diagram opposite shows nested rows.
In the Object Navigator, you can see the matrix structure in the Dimension and
Frequency nodes. These nodes exist only if there is a matrix. You do not see a node for
the matrix object name, but it does have properties. You can open the property palette
in the Layout Model only.

Creating a Matrix Object


When possible, use the wizard to create your matrix reports, since the layout consists
of many layers and interdependent objects.
If you resize the repeating frames, take care to maintain the intersection between them,
otherwise you might destroy the matrix object. Report Builder gives you a warning
message if this is likely to happen.
If you destroy the matrix object, or want to create the matrix structure yourself, you
must recreate the matrix object. Each matrix object intersects and determines the
relationship between two and only two repeating frames.

How to Create the Matrix Object


1 Make sure that the two related repeating frames intersect each other correctly.
2 Select both repeating frames (Shift-Select).
Note: if you do not select both frames, you receive an error message:
REP-3100: Matrix must include at least 1 Down and 1 Across repeating frame.
3 Choose Insert—>Layout Matrix.
4 Move the matrix object back through the layout layers until it is behind the cell
field (Arrange—>Move Backward). This step is not necessary to make the
report run, but it is useful to see the cell field if the matrix has a solid fill.

......................................................................................................................................................
Oracle Developer: Build Reports 14-13
Lesson 14: Enhancing Matrix Reports
......................................................................................................................................................

Creating Matrix Summaries

F_SumSALARY F_SumSALPerDEPT

F_Sum_REG_NAME

F_SumSALPerTITLE

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
14-14 Oracle Developer: Build Reports
Building a Nested Matrix
......................................................................................................................................................

Creating Nested Matrix Summaries


The wizard creates nested summaries in the cross product group.
If you create or alter a nested summary, you must set the Product Order correctly.
Always test the report output very carefully to ensure that the summaries are
displaying exactly the value you expect.

Setting the Product Order


Remember, the Product Order indicates the way in which Report Builder evaluates a
summary. Product Order also determines the position (frequency) of the summary if
you use the reenterable wizard.
The diagram opposite shows three summary fields created by the wizard:
• F_SumSALperTITLE: Total salary for each column of job title. Displayed once
for each title.
• F_SumSALperDEPT: Total salary for each department row nested within a
specific region row. Displayed once for each combination of region/department.
• F_SumSALARY: The cell value. Displayed once for each combination of
region/department/title.

Field Name Reset At Product Order


F_SumSALPerTITLE G_TITLE G_TITLE
F_SumSALPerDEPT G_DEPT_NAME G_DEPT_NAME
F_SumSALARY G_DEPT_NAME G_REG_NAME G_TITLE
G_DEPT_NAME

The diagram also shows a fourth summary, F_Sum_REG_NAME, which you might
want to create yourself, to produce a subtotal for each region.
1 Create another summary in the cross product group.
2 Create a layout field and place it as shown in the diagram, in the
R_G_REG_NAME repeating frame (use the Object Navigator to identify it).
The following table shows the property settings.

Field Name Reset At Product Order


F_Sum_REG_NAME G_REG_NAME G_REG_NAME

......................................................................................................................................................
Oracle Developer: Build Reports 14-15
Lesson 14: Enhancing Matrix Reports
......................................................................................................................................................

Displaying Zeros

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
14-16 Oracle Developer: Build Reports
Building a Nested Matrix
......................................................................................................................................................

Displaying Zeros in Cells with No Value


The field that displays each cell of the matrix is sourced to a summary column, such as
SumSalary.
If there is no value for a particular row/column combination, the summary column is
null and therefore the cells displayed as a blank field.
You can very simply change the blank to zero or any default value you choose.
To display zeros, open the property palette for either the cell field or the SumSalary
summary column and set the Value if Null property to zero.

......................................................................................................................................................
Oracle Developer: Build Reports 14-17
Lesson 14: Enhancing Matrix Reports
......................................................................................................................................................

Summary
• Create matrix with the wizard
• Consider creating or modifying a
template with extra spacing
• Data and layout reflect cross product
structure
• Matrix-specific:
– Cross Product group
– Product Order property
– Matrix layout object
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
14-18 Oracle Developer: Build Reports
Summary
......................................................................................................................................................

Summary
Let the Wizard and Template Work for You
Use the wizard to create your matrix, even if you need to modify it later. Allowing the
wizard to create the initial layout model saves you a lot of time.
If you make many modifications to your wizard reports, consider creating or
modifying a template to include object spacing horizontally and vertically, between
frames, fields, and so on. This helps you to select and manipulate the objects in the
Layout Model.
Note: Remember, you can override the default template properties for the Matrix and
Matrix with Group sections of an existing template.

Matrix Structure
The Data Model and Layout Model of a matrix report contain special features, and
relationships between objects, to reflect the cross product structure of the report.

Matrix-Specific Objects and Properties


Matrix reports include special objects, and properties:
• Data Model: Cross Product group; Product Order property
• Layout Model: Matrix object

......................................................................................................................................................
Oracle Developer: Build Reports 14-19
Lesson 14: Enhancing Matrix Reports
......................................................................................................................................................

Practice 14 Overview
• Opening and changing an existing
matrix report
• Building a nested matrix report
• Adding summaries to the nested matrix
report
• Displaying zeros for summary values
and restricting columns per page
• Displaying more meaningful column
information and rotating the text

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
14-20 Oracle Developer: Build Reports
Practice Session Overview: Lesson 14
......................................................................................................................................................

Practice Session Overview: Lesson 14


This practice session contains:
• Opening and changing an existing matrix report
• Building a nested matrix report
• Adding summaries to the nested matrix report
• Displaying zeros for summary values and restricting the number of columns per
page
• Displaying more meaningful column information and rotating the text

Introduction
In this practice session you use an existing matrix report to investigate the different
methods of displaying the cell values and the implications. You use an existing
external query to create a nested matrix report. You then add row and column-level
summaries to the report and display zeros for null values.
If you have time, include the product names instead of the product IDs and rotate the
names.

......................................................................................................................................................
Oracle Developer: Build Reports 14-21
Lesson 14: Enhancing Matrix Reports
......................................................................................................................................................

Practice Session: Lesson 14


1 Open report p4q6.rdf.
aUse the Report wizard to apply a template file to the report. The file
corpmat.tdf should be located in your working directory. The new
template gives you spaces between the layout objects to make it
easier to see the different objects in the Layout editor.
b How many repeating frames do you have?
c Change the properties of the cell object to display zero for a null
value.
d Run and test the report.
e Close the report without saving it.
2 Create a new report, importing the external query p4q6.sql from your working
directory.
a Choose the following settings:
Report Style Matrix
Query (Import file p4q6.sql)
Matrix Row Fields Level 1 - Month
Level 2 - Name
Matrix Column Fields Product_id
Matrix Cell Fields Sum of total_value
Matrix Totals Sum of the cell field

......................................................................................................................................................
14-22 Oracle Developer: Build Reports
Practice Session: Lesson 14
......................................................................................................................................................

b Change the labels and widths for the following fields:

Field Label Width


NAME Customer 10
PRODUCT_ID Product 5
MONTH Month 4
SUMTOTALVALUE Total 5
All Summaries Total: 5

Run the report.


c
d Which summaries were created?
e Use the Data Model editor to create summaries for each month and
for the level month and product.
f Use the Layout editor to create the fields. You will have to expand
the appropriate repeating frame.
g Run and test the report.
h Save the report as p14q2.rdf. Do not close it.
3 Continue with the report from the previous exercise.
a Add zeros for null values in the cells.
b Make sure that the report shows only three product columns on each
page.
c Format all numeric data to be right aligned.
d Add commas and two decimal places where appropriate.
e Run and test the report.
f Save the report as p14q3.rdf, and close it.

......................................................................................................................................................
Oracle Developer: Build Reports 14-23
Lesson 14: Enhancing Matrix Reports
......................................................................................................................................................

If You Have Time


4 Open the report as p14q3.rdf.
a Make the necessary changes in the Data Model editor to include the
product name.
b In the Layout Model editor delete the product_id field and insert a
boilerplate object to display the product name. Rotate this object by
90 degrees.
c Run and test the report.
d Save the report as p14q4.rdf and close it.

......................................................................................................................................................
14-24 Oracle Developer: Build Reports
15
................................

Coding PL/SQL Triggers


in Reports
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

Objectives

At the end of this lesson, you should be


able to do the following:
• Describe the different types of triggers
• Describe sample uses of triggers
• Write and reference common code
• Create a PL/SQL library

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
15-2 Oracle Developer: Build Reports
Overview
......................................................................................................................................................

Overview
Introduction
This lesson identifies different trigger types and creates conditional trigger code to
control report output. It also explains how to improve productivity and maintenance
by sharing and reusing commonly referenced code.

Objectives
At the end of this lesson, you should be able to do the following:
• Describe the different types of triggers
• Describe sample uses of the different types of triggers
• Write and reference common code
• Create and reference a PL/SQL library

......................................................................................................................................................
Oracle Developer: Build Reports 15-3
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

Types of Triggers in Reports


Report:
• Five triggers
• Report Trigger node in Object Navigator
Data Model:
• Formula (column)
• Filter (group)
• Parameter validation
Layout:
Format trigger on most objects
Copyright  Oracle Corporation, 1999. All rights reserved.

Trigger Code

Parameter
Boolean:
boolean
true
false

Column

Character
Number
Number
Date

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
15-4 Oracle Developer: Build Reports
Types of Triggers in Reports
......................................................................................................................................................

Types of Triggers in Reports


Introduction
You can code PL/SQL in a variety of triggers in a report to provide conditional or
additional processing at run time. This session discusses examples of each type of
PL/SQL trigger.

The Three Trigger Types


• Report:
- A set of five report-level triggers. Each trigger fires at a different stage of the
report execution.
- Access report triggers from the Report Triggers node in the Object
Navigator.
• Data Model:
- Column formula fires each time the column is processed.
- Group filter fires for each record in the group.
- Parameter validation fires when the run-time parameter form is displayed
and when the user leaves the parameter field.
- Access data model triggers in the property palette of a data model object—
column, group, or parameter—or the corresponding layout object—field,
repeating frame, or parameter field.
• Layout:
- Format triggers on most layout objects (excluding anchors). Each trigger
fires as the layout object is processed.
- Access format triggers in the property palette of a layout object.
Note: Report Builder does not allow data manipulation language (DML)
commands—INSERT, DELETE, UPDATE—in layout format triggers.

Trigger Code
When you create a trigger such as a report trigger or a PL/SQL formula, the
Program Unit editor supplies a template for the function block, giving the basic
syntax that you require.
You can change the name of the function.
The value that you return must match the return datatype in the function declaration.

......................................................................................................................................................
Oracle Developer: Build Reports 15-5
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

Using Report Triggers


Before
Parameter F
Form

1 2 if readonly=yes 3

F
if > 1 page
After Between After
Before page1 page2
Parameter Pages Report
Report
Form
F F

Copyright  Oracle Corporation, 1999. All rights reserved.

1 If After Parameter Form returns FALSE, the cursor returns to the


run-time parameter form. If the run-time parameter form is not
displayed, control returns to the calling program.
2 If READONLY=Yes, Report Builder implicitly sets the read-only
transaction (SET TRANSACTION READONLY) after the Before
Report Trigger fires.
3 If READONLY=Yes, Report Builder implicitly ends the
read-only transaction (COMMIT) after the final page and before
the After Report Trigger fires.

......................................................................................................................................................
15-6 Oracle Developer: Build Reports
Using Report Triggers
......................................................................................................................................................

Using Report Triggers


Introduction
Report triggers enable you to execute PL/SQL functions at specific times during the
execution and formatting of your report. These triggers enable you to:
• Customize the formatting of your report
• Perform initialization tasks
• Access the database
Report triggers must return a boolean value—true or false.

Accessing the Report Triggers


You can access the report triggers from the Object Navigator. Open the Report
Triggers node and double-click on the object icon of the required trigger to open the
program unit.
Trigger Fires Use to
Before Parameter Before run-time parameter form is Access and change parameter
Form displayed; fires even if parameter values (initial or command line),
form is suppressed global variables; create temporary
tables; insert into tables to be
queried
After Parameter After run-time parameter form Access and change parameter
Form is displayed; fires even if parameter values (initial, command line, or
form is suppressed user-entered); create temporary
tables; insert into tables to be
queried
Before Report Before a report executes: after Carry out initialization procedures
queries are parsed, but before
records are fetched
Between Pages Before each page is formatted, Carry out customized page
except the first page; in Previewer, formatting; insert or update values
fires only once for each page, even in tables
if you revisit the page
After Report After you exit the Previewer, or Clean up initial processing, such as
after report output is sent to its deleting temporary tables
destination; fires on success only

......................................................................................................................................................
Oracle Developer: Build Reports 15-7
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

Using Report Triggers


After Parameter Form
• Example: build dynamic WHERE clause
FUNCTION AfterPForm RETURN BOOLEAN IS
BEGIN
IF :p_customer IS NULL THEN
:p_where_clause := ’’;
ELSE
:p_where_clause := ’where id >= :p_customer’;
END IF;
RETURN(TRUE);
END;

• Query syntax:
SELECT
SELECT ID,
ID, NAME
NAME
FROM
FROM CUSTOMER
CUSTOMER
&p_where_clause
ORDER
ORDER BY
BY NAME
NAME
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
15-8 Oracle Developer: Build Reports
Using Report Triggers
......................................................................................................................................................

Creating a Dynamic WHERE Clause


Use the After Parameter Form report trigger to build a dynamic WHERE clause
depending on the value of a bind parameter that the user enters at run time.
There are two possibilities at run time:
• The bind parameter is NOT NULL:
The WHERE clause restricts the query; therefore the Oracle server makes use of
an existing index when retrieving data.
• The bind parameter is NULL:
The WHERE clause is also NULL; therefore the Oracle server uses a full table
scan to retrieve all records.

......................................................................................................................................................
Oracle Developer: Build Reports 15-9
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

Using Data Model Triggers


Group Filter
• Restrict records in a group
• Perform PL/SQL for each record
FUNCTION G_empGroupFilter RETURN BOOLEAN IS
BEGIN
IF :name = ’Operations’ AND :salary > 3000 THEN
RETURN(my_function);
ELSE
RETURN(TRUE);
END IF;
END;

• PL/SQL filters result in ALL records


being fetched
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
15-10 Oracle Developer: Build Reports
Using Data Model Triggers
......................................................................................................................................................

Using Data Model Triggers


Introduction
This section gives examples of:
• Using a PL/SQL group filter
• Validating a parameter value

Using a PL/SQL Group Filter


Use a group filter when you want to do the following:
• Restrict records in a specific group, depending on other processing in the report;
that is, when a WHERE clause in a query is not applicable
• Perform some PL/SQL processing for each record in a group
A group filter is useful when you want to restrict group values of a lower group in
the group hierarchy.
The function must return a boolean value:
• True: the record is included
• False: the record is excluded
Report Builder fetches all records and applies the group filter to each record.
Therefore avoid group filters as a method of restricting many records in a group.
Note: You cannot add a filter to a matrix cross product group.

Example
Use a group filter that calls a function for some records in the G_emp group,
depending on the department in the master group.
1 Open the property palette for the G_emp group.
2 Change Group Filter to PL/SQL.
The PL/SQL Filter property appears.
3 Choose the PL/SQL Filter property to open the PL/SQL editor.
4 Enter the code. This filter code must return a boolean value, true or false.
Note: It is more efficient to use a WHERE clause in a query when possible. You
cannot use a WHERE clause in this case, because you want to process all records
and call the function for some.

......................................................................................................................................................
Oracle Developer: Build Reports 15-11
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

Using Data Model Triggers


Parameter Validation
• Example: do not allow report output to
be sent directly to a printer
FUNCTION DESTYPEValidTrigger RETURN BOOLEAN IS
BEGIN
IF :DESTYPE = ’Printer’ THEN
RETURN(FALSE);
ELSE
RETURN(TRUE);
END IF;
END;

• You cannot reassign values to


parameters or columns in this trigger
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
15-12 Oracle Developer: Build Reports
Using Data Model Triggers
......................................................................................................................................................

Validating a Parameter Value


Both system parameters and user parameters have a Validation Trigger property, in
which you can write a PL/SQL function to validate the value of the parameter.
The trigger code must return a boolean value—true or false—depending on whether
the validation is successful or not.
If the returned value is false, the cursor remains in the parameter and the user has
the following two options:
• Enter a different value
• Cancel the report
You can test the value of a parameter, but you cannot change the value. If you want
to assign a new value to the parameter, use the After Parameter Form report trigger.

Example To prevent report output from being sent directly to a printer, test the
value of the DESTYPE system parameter.
1 Open the property palette for the DESTYPE parameter.
2 Choose Validation Trigger to open the PL/SQL editor.
3 Enter the code and make sure that the value Printer has an initial capital.

......................................................................................................................................................
Oracle Developer: Build Reports 15-13
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

Using Layout Triggers

Format triggers:
• Exist on most layout objects
• Can suppress an entire layout section
(master group frame): no records
fetched
• Can suppress the display of individual
records (repeating frame): all records
fetched

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
15-14 Oracle Developer: Build Reports
Using Layout Model Triggers
......................................................................................................................................................

Using Layout Model Triggers


Introduction
Most layout objects contain a format trigger; it is one of the common properties of a
layout object.
Format triggers enable you to modify the display of objects dynamically at run time
or to suppress display altogether.
The trigger must return a boolean value—true or false.
The following pages discuss some examples of format triggers.

Suppressing the Entire Layout for a Query


Because Report Builder is driven by the layout, you can use a format trigger on a
group frame to conditionally suppress the entire layout associated with a query. In
this case, the query does not retrieve any data.

Suppressing Individual Records


Do not use format triggers to suppress individual records that you can restrict on the
Data Model. For example, a format trigger on a repeating frame does not prevent
data from being retrieved, it simply determines whether or not you see it in the
output.
Therefore it is more efficient to restrict individual records using the Maximum
Records property in a query or a First type of group filter when possible.
Note: Summaries compute against all data fetched by the Data Model. If you
suppress records in the layout only, summaries give misleading results.

......................................................................................................................................................
Oracle Developer: Build Reports 15-15
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

Displaying a Text String in Place


of Column Headings
Dept: 10
Dept: f_deptno
Name Salary
Name Salary
No employees in
1 this department
Dept: 40
No employees in
this department

Copyright  Oracle Corporation, 1999. All rights reserved.

1 Boilerplate text: Position behind column heading frame, or


position below and create collapsible anchor to column heading
2 Column heading frame does not display; Suppressed by format
trigger

......................................................................................................................................................
15-16 Oracle Developer: Build Reports
Using Layout Model Triggers
......................................................................................................................................................

Coding a Format Trigger on a Frame

Requirement: Display a Text String In Place of Column Headings Display a


master-detail report for departments and employees. If a department has no
employees, suppress the detail column heading frame and display a piece of text
instead.

Example
1 Create a summary column, :count_emp, in the master group that counts the
number of employee records (reset = master group).
2 Create a piece of boilerplate text, “No employees in this department”.
3 Position the text behind the column heading frame.
4 Code a format trigger on the column heading:
function hide_headings return boolean is
begin
if :count_emp = 0 then
return(false);
else
return(true);
end if;
end;
5 Either code the reverse logic in the format trigger of the boilerplate text item
created in step 2 or ensure that the column heading frame has a solid fill.
Note: You should code format triggers at the highest possible level of the layout
hierarchy. The format trigger on the column headings frame suppresses all objects
enclosed by the frame. Do not duplicate code unnecessarily by coding the same
trigger on all individual objects in the frame; this can cause increased processing
and maintenance overheads.

......................................................................................................................................................
Oracle Developer: Build Reports 15-17
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

Dynamically Altering the Display


of Records
Employee Details
Employee Details
Ngao 08-MAR-90 2500
f_name f_date f_salary Biri 07-APR-91 1100
Employee 1000
Magee 14-MAY-90 Details
f_name f_date
Ngao 08-MAR-90
Biri 07-APR-91
2 Magee 14-MAY-90

1 3
Copyright  Oracle Corporation, 1999. All rights reserved.

1 One repeating frame is positioned behind the other or positioned


below with collapsing anchor
2 Report output run by payment clerks
3 Report output run by other employees

......................................................................................................................................................
15-18 Oracle Developer: Build Reports
Using Layout Model Triggers
......................................................................................................................................................

Coding a Format Trigger on a Repeating Frame

Requirement: Dynamically Alter the Display of Records Dynamically In a


report of employee details, display salaries if the user is a payment clerk, but hide
salaries and alter the appearance of remaining fields when any other employee runs
the report.

Example
1 In the layout, create two repeating frames sourced by the same group. One
repeating frame must contain a salary field, the other must not.
Note: You can create two separate default layouts and modify the layout as
required.
2 Place one repeating frame behind the other.
3 Add a format trigger to suppress the top repeating frame (the one that contains
the salary field), or alternatively use conditional formating:
function pay_clerks_see_this return boolean is
begin
if :user_type = ’PAY_CLERK’ then
return(true);
else
return(false);
end if;
end;
Note: User_type can be a column or parameter that is initialized at run time.
4 Either code the reverse logic on the other repeating frame or ensure that the top
repeating frame (containing salary) has a solid fill.

......................................................................................................................................................
Oracle Developer: Build Reports 15-19
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

Dynamically Hiding Fields

Employee Details
Employee Details

f_name f_date f_salary


Ngao 08-MAR-90 2500 1
Biri 07-APR-91 1100
Employee 1000
Magee 14-MAY-90 Details

Ngao 08-MAR-90
Biri 07-APR-91
Magee14-MAY-90

2
Copyright  Oracle Corporation, 1999. All rights reserved.

1 Report for payment clerks shows all fields


2 Report for other employees shows gap where salary is hidden

......................................................................................................................................................
15-20 Oracle Developer: Build Reports
Using Layout Model Triggers
......................................................................................................................................................

Format Trigger on a Field

Requirement: Dynamically Hide Fields Given the same employee details


report as before, hide the salary field without rearranging the other fields in the
repeating frame. The report contains a gap in the layout when the salary field is not
displayed.

Example Place the format trigger on the salary field to display it only when
payment clerks run the report. The code is the same as before:
function pay_clerks_see_this return boolean is
begin
if :user_type = ’PAY_CLERK’ then
return(true);
else
return(false);
end if;
end;
In this example you do not need to create any additional layout object or code.

......................................................................................................................................................
Oracle Developer: Build Reports 15-21
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

Suppressing Null Fields in a


Letter Heading
f_name
f_address1
f_address2 1
f_address3
f_address4
2
FUNCTION
FUNCTION label_field
label_field RETURN
RETURN BOOLEAN
BOOLEAN IS
IS
Dear Sir, BEGIN
BEGIN
We are writingIF
IF :address2
:address2
to advise .... IS
IS NULL
NULL THEN
THEN
...... RETURN(FALSE);
RETURN(FALSE);
...... ELSE
ELSE
RETURN(TRUE);
RETURN(TRUE);
END
END IF;
IF;
END;
END;
Copyright  Oracle Corporation, 1999. All rights reserved.

1 Format Trigger on F_Address2 field references the column


ADDRESS2
2 Create anchors, with Collapse Vertically=Yes, on fields below the
suppressed field

......................................................................................................................................................
15-22 Oracle Developer: Build Reports
Using Layout Model Triggers
......................................................................................................................................................

Coding a Format Trigger on a Field

Requirement: Suppress Null Fields in an Address The letter opposite includes


a customer address. Address lines in a database often have optional fields to
provide for a variable number of lines in an address.
You want to suppress fields that are NULL, so that the address does not contain
large spaces between existing lines.

Example
1 Code a format trigger on the optional field to suppress the field when the value
is NULL.
2 Create an anchor from the field below, up to the optional field. Set the Collapse
Vertically property to Yes. Repeat for all fields below the optional field to avoid
any unwanted space in the label.

......................................................................................................................................................
Oracle Developer: Build Reports 15-23
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

Inserting Spacing Between


Groups of Records
f_1 f_2 f_3

1 2
3 4
FUNCTION
FUNCTION spacing
spacing RETURN
RETURN BOOLEAN
BOOLEAN IS
IS
BEGIN
BEGIN
IF
IF MOD(:count_column,
MOD(:count_column, 3)
3) == 00 THEN
THEN
RETURN(TRUE);
RETURN(TRUE);
ELSE
ELSE
RETURN(FALSE);
RETURN(FALSE);
END
END IF;
IF;
END;
END;
Copyright  Oracle Corporation, 1999. All rights reserved.

1 Transparent rectangle 3 Summary column name


(created in Data Model)
2 Repeating Frame, Vertical 4 Format trigger on
Elasticity = Variable transparent rectangle

......................................................................................................................................................
15-24 Oracle Developer: Build Reports
Using Layout Model Triggers
......................................................................................................................................................

Coding a Format Trigger on a Boilerplate Object

Requirement: Insert Spacing Between Groups of Records Display additional


spacing between a defined number of records; for example, group every three
records together.

Example
1 Create a transparent rectangle inside the repeating frame to increase spacing
conditionally at run time.
2 In the repeating frame property palette, set Vertical Elasticity to Variable.
3 In the Data Model, create a summary column named COUNT_COLUMN that
counts the number of records retrieved (Reset=Report).
4 On the rectangle, create a format trigger that references the summary column, as
shown on the opposite page.
Note: You can vary the number of records in each group dynamically at run time by
creating a parameter.

......................................................................................................................................................
Oracle Developer: Build Reports 15-25
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

Writing Common Code


At Report level
• Object Navigator, Program Units
• Menu: Tools—>PL/SQL Editor
In a library
• Object Navigator, PL/SQL Library
• File—>New: create new library
• File—>Open: add to existing library
• Attach library to report

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
15-26 Oracle Developer: Build Reports
Writing Common Code
......................................................................................................................................................

Writing Common Code


Introduction
If you use the same program unit in several places in a report, or in multiple reports,
consider writing the code once as a report-level program unit, or in a PL/SQL
library, and then call the program unit when you require it in your PL/SQL trigger
code; this enables you to maintain the code in one place.
Even if you do not use the code many times, consider writing anything other than
very simple PL/SQL blocks at report level, to simplify maintenance.
Remember that you can also code stored procedures and functions in the database;
you must decide whether server-side or client-side processing is more efficient in
each case.

Two Ways to Create Report-Level Program Units


• In the Object Navigator, select the Program Units node and create a new
program unit.
• From the menu, select Program—>PL/SQL Editor. Choose New to create a new
program unit.

Writing Code as Report-Level Program Units


You can create a report-level program unit that contains a function, procedure, or
package, and that you call from any object in the same report. You cannot reference
a report-level program unit from a different report.

Three Ways to Create Library Program Units


• In the Object Navigator, select the PL/SQL Libraries node and create a new
library.
• From the menu, select File—>New—>PL/SQL Library.
• From the menu, select File—>Open to open an existing library and create
additional program units.

Referencing Code from a PL/SQL Library


You can reference library code in a report trigger by attaching one or more libraries
to one or more report definitions, which enables you to reference the same code in
multiple reports.
To attach a library to a report, open the report definition, select the Attached
Libraries node in the Object Navigator, and add each library that you need in the
report.

......................................................................................................................................................
Oracle Developer: Build Reports 15-27
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

Summary
Trigger types
• Report, Data Model, Layout
Examples
• Building a dynamic WHERE clause
• Validating a parameter value
• Dynamically altering record display
• Suppressing null fields
Common code
• Report-level program units
• PL/SQL libraries
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
15-28 Oracle Developer: Build Reports
Summary
......................................................................................................................................................

Summary
Using PL/SQL Triggers
Choose the most applicable type of trigger for your requirement.
Report-level triggers fire once for each of the five events during the report
execution.
Data Model triggers can affect which records are processed and how they are
processed.
Layout triggers affect the way in which objects are formatted.

Writing Common Code


Use report-level program units or PL/SQL libraries for common code requirements
to improve productivity and maintenance.

Objects That Must Return a Value


The following table is a reminder of the Report Builder triggers that must always
return a value, and it shows the values that are acceptable.
Trigger Type Valid Values Result if False
Report trigger True, False Abort execution
Group filter True, False Do not process record
Validation trigger True, False Return to parameter form
Format trigger True, False Do not format object
PL/SQL Formula (column) Computation: Character, N/A
Number, Date

......................................................................................................................................................
Oracle Developer: Build Reports 15-29
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

Practice 15 Overview

• Creating a format trigger to display


different layouts conditionally
• Creating and using a report-level
PL/SQL function
• Creating and using an external PL/SQL
library
• Creating a PL/SQL group filter

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
15-30 Oracle Developer: Build Reports
Practice Session Overview: Lesson 15
......................................................................................................................................................

Practice Session Overview: Lesson 15


This practice session contains:
• Creating a format trigger to display different layouts conditionally
• Creating and using a report-level PL/SQL function
• Creating and using an external PL/SQL library
• Creating a PL/SQL group filter

Introduction
In this practice session you create a format trigger, or use conditional formatting to
display one of two layouts for the same data, depending on a parameter value at run
time. You also conditionally flag some records in a report by creating and
referencing a report-level (local) PL/SQL function. You then move the code into a
new PL/SQL library and alter the reference to use the library function instead.
If you have time, restrict the number of records processed in a report by creating
your own group filter.

......................................................................................................................................................
Oracle Developer: Build Reports 15-31
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

Practice Session: Lesson 15


1 Create a new report, using p15q1.sql.
a Display the records in two different layouts, showing different
columns in each.
b Create a Group Above layout using the following columns from the
query:

Group Column
G_CUSTOMER CUSTOMER_ID
G_ID ID
DATE_ORDERED
DATE_SHIPPED
PAYMENT_TYPE
TOTAL

c Create a Tabular layout using the following columns from the query:

Column
ID
DATE_ORDERED
DATE_SHIPPED
TOTAL

d Make sure that only the Group Above layout is displayed when you
choose a destination of Screen, and only the Tabular layout is
displayed when you choose a destination of Preview.
To test the result, display the DESTYPE parameter in the report.
Make sure that you can enter a parameter value at run time.
Hint: As an alternative to coding Format triggers, you can also use
Conditional Formatting.
e Save the report as p15q1.rdf.

......................................................................................................................................................
15-32 Oracle Developer: Build Reports
Practice Session: Lesson 15
......................................................................................................................................................

2 Continue with the previous report.


Modify the report so that the Tabular (Preview) layout displays an
a
extra column that indicates, with an asterisk, those orders that were
shipped more than 15 days after the order date.
b Remember to change destination to Preview during testing.
c Move the function code into a new PL/SQL library, named
p15lib.pll.
d Call the external function from your report, instead of calling the
report-level function.
e Save the report to p15q2.rdf.
3 Continue with the previous report.
a Modify the same layout to display additional spacing between every
two records.
b Save the report as p15q3.rdf and close it.

If You Have Time


4 Open report p15q1.rdf.
a Write your own group filter to restrict the number of customers
displayed depending on the value of a parameter that you enter at run
time.
Hint: You need to create two parameters to keep track of how many records
have been processed compared to the cutoff number of records required.
b Test the report several times by changing the cutoff parameter at run
time.
c Save the report as p15q4.rdf.

......................................................................................................................................................
Oracle Developer: Build Reports 15-33
Lesson 15: Coding PL/SQL Triggers in Reports
......................................................................................................................................................

......................................................................................................................................................
15-34 Oracle Developer: Build Reports
16
................................

Using the Report Builder


Built-In Package
Lesson 16: Using the Report Builder Built-In Package
......................................................................................................................................................

Objectives

At the end of this lesson, you should be


able to do the following:
• Describe the package contents
• Output messages at run time
• Execute a drill-down report
• Create and populate temporary tables
• Modify visual attributes dynamically

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
16-2 Oracle Developer: Build Reports
Overview
......................................................................................................................................................

Overview
Introduction
This lesson provides examples of the contents and use of the Report Builder built-in
package. The package contains program units that you can reference in your
PL/SQL code.

Objectives
At the end of this lesson, you should be able to do the following:
• Describe the contents of the Report Builder built-in package
• Output messages at run time
• Execute a drill-down report
• Create and populate temporary tables within a report
• Modify visual attributes dynamically at run time

......................................................................................................................................................
Oracle Developer: Build Reports 16-3
Lesson 16: Using the Report Builder Built-In Package
......................................................................................................................................................

Contents of the SRW Package

SRW.BREAK SRW.DO_SQL
SRW.SET_ATTR SRW.RUN_REPORT

SRW.REFERENCE SRW.MESSAGE
SRW.USER_EXIT SRW.TRACE
SRW.SET_MAXROW SRW.PROGRAM_ABORT

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
16-4 Oracle Developer: Build Reports
Contents of the Report Builder Built-in Package
......................................................................................................................................................

Contents of the Report Builder Built-in Package


Introduction
The Report Builder built-in package, known as the SRW package, contains
procedures, functions, and exceptions that can help you to do the following:
• Control report execution
• Output messages at run time
• Initialize layout fields
• Perform DDL statements (create or drop temporary tables)
• Call user exits
• Dynamically set format attributes, such as font style and fill patterns

Referencing the Contents of the Package


You can reference any part of the SRW package in a PL/SQL statement in any PL/
SQL area of a report, such as a layout format trigger or a report-level trigger.

Rules
• You can only call the contents of the SRW package from within Report Builder.
Other tools, such as Form Builder, do not recognize this package.
• You must always reference an SRW procedure, function, or exception by
preceding it with the package name, SRW; for example, SRW.MESSAGE,
SRW.DO_SQL.

......................................................................................................................................................
Oracle Developer: Build Reports 16-5
Lesson 16: Using the Report Builder Built-In Package
......................................................................................................................................................

Outputting Messages
Warning
WHEN
WHEN <exception>
<exception> THEN
THEN
SRW.MESSAGE(999,
SRW.MESSAGE(999,
’Warning:
’Warning: report
report continues’);
continues’);
Error
WHEN
WHEN <exception>
<exception> THEN
THEN
SRW.MESSAGE(999,
SRW.MESSAGE(999,
’Error:
’Error: report
report terminated’);
terminated’);
RAISE SRW.PROGRAM_ABORT;
Exceptions
SRW.INTEGER_ERROR
SRW.INTEGER_ERROR
SRW.NULL_ARGUMENTS
SRW.NULL_ARGUMENTS
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
16-6 Oracle Developer: Build Reports
Outputting Messages
......................................................................................................................................................

Outputting Messages
Introduction
The SRW.MESSAGE packaged procedure displays a message with a code and text
string, which you specify. The message is displayed in the following format:
MSG-code: text
The message is displayed in a small dialog box. The user must acknowledge the
message before continuing.

Message Code and Text


You can enter a code number from zero up to 10 digits. If you enter a number of
fewer than five digits, the code is displayed with leading zeros.
You can enter a text string to a maximum of 190 characters, excluding the code
number. You can embed extra spaces to display your message neatly in the message
dialog box. Reports does not suppress extra spaces in the message text.

Is It a Warning or an Error?
SRW.MESSAGE does not implicitly terminate the report execution. You can choose
to issue a warning message that enables the report to continue execution after the
user accepts the message.
To force the report to terminate after outputting the message, raise the exception
SRW.PROGRAM_ABORT.
Note: You cannot suppress or replace the default message that Report Builder gives
if you abort a report. Your own error message augments the existing messages.

Causes of Exceptions
Exception Name Cause
SRW.INTEGER_ERROR You entered a code that is not a numeric integer.
SRW.NULL_ARGUMENTS You omitted either the code number or text message
or both.

......................................................................................................................................................
Oracle Developer: Build Reports 16-7
Lesson 16: Using the Report Builder Built-In Package
......................................................................................................................................................

Executing a Report
1 BLOGGS.LIS 2
BLOGGS xxx xxxxxxx
xxx xxxxxxx
SMITH
SMITH.LIS

JONES yyy yyyyyyy


yyy yyyyyyy

JONES.LIS
zzz zzzzzzz
SRW.RUN_REPORT zzz zzzzzzz

Copyright  Oracle Corporation, 1999. All rights reserved.

1 Output from master output


2 Output from detailed report

......................................................................................................................................................
16-8 Oracle Developer: Build Reports
Executing a Nested Report
......................................................................................................................................................

Executing a Nested Report


Introduction
Use SRW.RUN_REPORT to execute a second report from within a report process.
For example:
• Output parts of a report to different destinations
• Divide a large report into several smaller reports that can be run conditionally

Both Reports Use the Same Process


SRW.RUN_REPORT starts only one run-time process; it does not start a new
process for each report execution.

Example
Run a report called MANAGERS that retrieves the employee record for each
manager. Call the EMPS report (for example, from a group filter). EMPS retrieves
the employee records of all employees managed by the current manager only.
Sample code to implement this example appears on the following page.

......................................................................................................................................................
Oracle Developer: Build Reports 16-9
Lesson 16: Using the Report Builder Built-In Package
......................................................................................................................................................

Executing a Report
Example
SRW.RUN_REPORT
(’Report=EMPS
DESTYPE=FILE
DESNAME=’||:LAST_NAME||’.LIS
BATCH=YES
MGRNO=’||TO_CHAR(:ID));

Exceptions
SRW.RUN_REPORT_FAILURE
SRW.RUN_REPORT_FAILURE
SRW.RUN_REPORT_BATCHNO
SRW.RUN_REPORT_BATCHNO

Function
SRW.GETERR_RUN
SRW.GETERR_RUN
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
16-10 Oracle Developer: Build Reports
Executing a Nested Report
......................................................................................................................................................

Example Function Code


FUNCTION MGR_REP RETURN BOOLEAN IS
BEGIN
SRW.RUN_REPORT
(’REPORT=EMPS
DESTYPE=FILE
DESNAME=’||:LAST_NAME||’.LIS
BATCH=YES
MGRNO=’||TO_CHAR(:ID));
RETURN(TRUE);
EXCEPTION
WHEN SRW.RUN_REPORT_FAILURE THEN
SRW.MESSAGE(100, ’Error executing EMPS report’);
RAISE SRW.PROGRAM_ABORT;
END;

Note: Use LAST_NAME to create the output filename for each manager; use ID to
restrict the EMPS query.

Causes of Exceptions
Report Builder raises a specific exception that applies to the SRW.RUN_REPORT
procedure in two cases:
Exception Name Causes
SRW.RUN_REPORT_FAILURE Detail report does not exist.
Detail report failed during execution.
SRW.RUN_REPORT_BATCHNO BATCH parameter is used inconsistently:
master report running with BATCH=YES,
called a detail report with BATCH=NO.

Displaying Report Failure Message


If the detail report fails during execution, you can display information about the
cause by using the SRW.GETERR_RUN function.
Assign the function to a local PL/SQL character variable, which you display using
the SRW.MESSAGE procedure.
...
msg char(150);
...
EXCEPTION
WHEN SRW.RUN_REPORT_FAILURE THEN
msg := SRW.GETERR_RUN;
SRW.MESSAGE (100, msg);
...

......................................................................................................................................................
Oracle Developer: Build Reports 16-11
Lesson 16: Using the Report Builder Built-In Package
......................................................................................................................................................

Executing a Drill-Down Report


1 2

41 Details 42
xxxxxxxxx
42 Details
SRW.RUN_REPORT xxxxxxxxx
xxxxxxxxx
43 Details
xxxxxxxxx

Copyright  Oracle Corporation, 1999. All rights reserved.

1 Output from master output


2 Output from detailed report

......................................................................................................................................................
16-12 Oracle Developer: Build Reports
Executing a Nested Report
......................................................................................................................................................

Calling a Drill-Down Report


You can call the SRW.RUN_REPORT procedure from a button in your master
report and display the detail report in a second previewer window on the screen.

How to Create a Drill-Down Report


1 Create a button in the master report within the repeating frame.
2 Display the button property palette. Under the Button Behavior node, change
the Type property to PL/SQL, then select the PL/SQL Trigger property to
display the Program Unit editor.
3 Enter the function as described in the previous example. Do not include the
BATCH parameter, since you want to display the detail report interactively in a
second previewer.
4 Compile and close the Program Unit editor.
5 Run the master report.
For reports that you send to a file, do not include the pathname when coding the
DESNAME parameter. Allow the REPORTS60_PATH variable to search the
correct path for the report.

Testing Drill-Down Reports During Development


To test a drill-down report, use the Reports Runtime. Remember that buttons are not
active in the Report Builder Live Previewer.

......................................................................................................................................................
Oracle Developer: Build Reports 16-13
Lesson 16: Using the Report Builder Built-In Package
......................................................................................................................................................

Restricting Data
Before Report trigger
SRW.SET_MAXROW(’Q_EMP’,3);

Q_EMP ID LAST_NAME

G_EMP 1 BLOGGS
2 SMITH
ID 3 JONES
LAST_NAME

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
16-14 Oracle Developer: Build Reports
Restricting Data
......................................................................................................................................................

Restricting Data
Introduction
Use SRW.SET_MAXROW to restrict the maximum number of records you want to
retrieve for a specified query. Report Builder uses only the retrieved rows of the
query in subsequent processing, such as computations and summaries.

Suppressing a Query
At run time, you can choose not to display any data from a query by setting the
maximum number of records to zero. This prevents Report Builder from retrieving
any records from the database.

Example
Below is a function to display data for the Q_emp query only if a value of one or
more is entered in a run-time parameter called HOW_MANY:
FUNCTION FETCHIT RETURN BOOLEAN IS
BEGIN
IF :HOW_MANY >= 1 THEN
SRW.SET_MAXROW (’Q_emp’, :how_many);
ELSE
SRW.SET_MAXROW(’Q_emp’, 0);
END IF;
RETURN(TRUE);
EXCEPTION
WHEN SRW.MAXROW_UNSET THEN
SRW.MESSAGE (100,
’Data was fetched before SRW.MAXROW was called’);
RAISE SRW.PROGRAM_ABORT;
WHEN SRW.MAXROW_INERR THEN
SRW.MESSAGE(200, ’Contact someone clever!’);
RAISE SRW.PROGRAM_ABORT;
END;
You must set SRW.SET_MAXROW in the Before Report trigger; that is, after the
query has been parsed but before it has been executed. If you call it after the Before
Report trigger, Report Builder raises the SRW.MAXROW_UNSET exception.
If you handle SRW.MAXROW_INERR, always raise SRW.PROGRAM_ABORT,
because your report has an internal problem and you cannot guarantee the outcome.

......................................................................................................................................................
Oracle Developer: Build Reports 16-15
Lesson 16: Using the Report Builder Built-In Package
......................................................................................................................................................

Initializing Fields
Layout editor Output: logical
page no. = 2

Page: F_NEWPAGE
Page: 5

1
FUNCTION
FUNCTION F_LOGICAL_PAGEFormatTrigger
F_LOGICAL_PAGEFormatTrigger
RETURN
RETURN BOOLEAN
BOOLEAN IS
IS
my_page
my_page number;
number;
BEGIN
BEGIN
SRW.GET_PAGE_NUM(my_page);
SRW.GET_PAGE_NUM(my_page); 2
SRW.SET_FIELD_NUM(0,my_page+3);
SRW.SET_FIELD_NUM(0,my_page+3);
RETURN(TRUE);
RETURN(TRUE);
END;
END;
Copyright  Oracle Corporation, 1999. All rights reserved.

1 Create format trigger on f_newpage field


2 Set field value to my_page+3

......................................................................................................................................................
16-16 Oracle Developer: Build Reports
Initializing Fields
......................................................................................................................................................

Initializing Fields
You can dynamically initialize the value in a layout field by using the relevant
SET_FIELD packaged procedure; for example:
• SRW.SET_FIELD_CHAR (0, ’a text string’)
• SRW.SET_FIELD_NUM (0, 1234)
• SRW.SET_FIELD_DATE (0, ’01-JAN-95’)
The first argument is always 0 (zero); you can set the value of the current object.
These procedures are relevant only in the format trigger of a field of the correct
type. If you use a procedure that conflicts with the field type, it has no effect in the
report; Report Builder ignores the code and does not raise an error.

Why Use SRW.SET_FIELD?


You might want to retrieve the current logical page number and recalculate the
value before displaying it.

Example Create a function to display the logical page number + 3 in a field called
F_NEWPAGE.
Because the logical page number variable is available only in the report layout, not
in the Data Model, you cannot calculate the value in a data column. Therefore you
use a layout field to get the current page number and output a new number by
initializing the same field.
Make use of a packaged procedure called SRW.GET_PAGE_NUM to retrieve the
current logical page number into a local PL/SQL variable, as in the format trigger
code opposite.

......................................................................................................................................................
Oracle Developer: Build Reports 16-17
Lesson 16: Using the Report Builder Built-In Package
......................................................................................................................................................

Performing DDL Statements


Example
SRW.DO_SQL(’CREATE TABLE SRW_LOG
(RPT_NAME VARCHAR2(40),
REC_NUM NUMBER,
MSG_TEXT VARCHAR2(80))’);

SRW.DO_SQL(’INSERT INTO SRW_LOG


(RPT_NAME, REC_NUM, MSG_TEXT)
VALUES
(’’PAY_REPORT’’, TO_CHAR(:ID),
:LAST_NAME||’’PAY REPORT RUN’’)’);

Exception
SRW.DO_SQL_FAILURE
SRW.DO_SQL_FAILURE
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
16-18 Oracle Developer: Build Reports
Performing DDL Statements
......................................................................................................................................................

Performing DDL Statements


Introduction
The SRW.DO_SQL packaged procedure executes any specified SQL statement
from within Report Builder.

Why Use SRW.DO_SQL?


Use SRW.DO_SQL to perform DDL statements dynamically, during run time. For
example, create a temporary table and insert rows into it during execution.
You can also perform DML statements using this procedure, but DML statements
run faster if you code them directly within a PL/SQL block. Code DML statements
in the SRW.DO_SQL procedure only if necessary. For example:
• To insert records into a permanent table in the database, code DML in a PL/SQL
block.
• To insert records into a temporary table that does not exist until run time, code
DML in SRW.DO_SQL.

Querying from Temporary Tables


If you want to create a temporary table and reference it in a query in the same report,
the table must exist before the Before Report trigger fires. That is when Report
Builder parses its queries. Therefore you must create this table in the Before
Parameter Form or After Parameter Form report trigger.

......................................................................................................................................................
Oracle Developer: Build Reports 16-19
Lesson 16: Using the Report Builder Built-In Package
......................................................................................................................................................

Setting Format Attributes


borderwidth
Tuesday, 01 Sep fill pattern
format mask

printer tray control

Car Policy define a bookmark

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
16-20 Oracle Developer: Build Reports
Setting Format Attributes
......................................................................................................................................................

Setting Format Attributes


Introduction
The SRW.SET_<attributes> packaged procedures apply specified format attributes
to the current layout object: frame, repeating frame, field, or boilerplate object.

Why Use a Format Attribute?


Some of the reasons that you would want to use format attributes are:
• To change the visual appearance of layout objects conditionally, depending on
values in a repeating frame, or on run-time parameter values
• To switch to different printer trays as your report formats
• To place a logo or standard links in an HTML document
• To define a bookmark in an HTML or PDF document

Coding a Format Attribute


You can code the packaged procedure in a function as a local or report-level
program unit, or in a PL/SQL library. This is useful if you want a common format
attribute in more than one object or more than one report. You can then call the
function whenever required, from the format trigger of a specific object.
As an alternative to a PL/SQL library, in the Object Navigator you can drag and
drop report-level program units between different reports. However, note that this
creates a copy of the program unit in each report, rather than a reference to one
piece of code.

......................................................................................................................................................
Oracle Developer: Build Reports 16-21
Lesson 16: Using the Report Builder Built-In Package
......................................................................................................................................................

Setting Format Attributes

Visual attributes
SRW.SET_FILL_PATTERN(’solid’);
SRW.SET_BORDER_WIDTH(250);
SRW.SET_FORMAT_MASK(’Day, Month yyyy’);

Printer tray control


SRW.SET_PRINTRER_TRAY(’letterhead’);
SRW.SET_PRINTRER_TRAY(’letterhead’);

Define a bookmark
SRW.SET_BOOKMARK(’Car
SRW.SET_BOOKMARK(’Car Policy’);
Policy’);

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
16-22 Oracle Developer: Build Reports
Setting Format Attributes
......................................................................................................................................................

Example
Conditionally set the following attributes if salary equals 2000:
Attribute Value
Background fill color Dark yellow
Fill pattern Sandpaper
Font style Italic
Font face Helvetica
Font weight Extra bold
Text color Dark blue
FUNCTION SAL_MASK RETURN BOOLEAN IS
BEGIN
IF :SALARY > 2000 THEN
SRW.SET_BACKGROUND_FILL_COLOR(‘darkyellow’);
SRW.SET_FILL_PATTERN(‘sandpaper’);
SRW.SET_FONT_STYLE(SRW.ITALIC_STYLE);
SRW.SET_FONT_FACE(‘helvetica’);
SRW.SET_FONT_WEIGHT(SRW.EXTRABOLD_WEIGHT);
SRW.SET_TEXT_COLOR(‘darkblue’);
END IF;
RETURN(TRUE);
END;

Using Format Attributes in Character-Mode Reports


Some attributes are applicable to character environments only; some are for
bitmapped environments only.
If you include a bitmapped attribute and then run the report in character mode, or
the reverse, Report Builder ignores the code and does not cause an error. This
enables you to develop a report for use in a different environment.

......................................................................................................................................................
Oracle Developer: Build Reports 16-23
Lesson 16: Using the Report Builder Built-In Package
......................................................................................................................................................

Summary
Package contents
• Procedures
• Functions
• Exceptions:
SRW.PROGRAM_ABORT to exit
Examples
• Drill-down report
• Support for DDL statements
• Conditional layout formatting and display
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
16-24 Oracle Developer: Build Reports
Summary
......................................................................................................................................................

Summary
• The SRW package contains procedures, functions, and exceptions.
Remember that you can raise the exception SRW.PROGRAM_ABORT in your
PL/SQL code to stop report processing at any time.
• The SRW package provides a number of features, including:
- Drill-down reports, using SRW.RUN_REPORT in a button
- Support for DDL statements, using SRW.DO_SQL, to enable you to create
or drop temporary tables from PL/SQL code in a report
- Conditional formatting and display using SRW.SET<attr> attributes

......................................................................................................................................................
Oracle Developer: Build Reports 16-25
Lesson 16: Using the Report Builder Built-In Package
......................................................................................................................................................

Practice 16 Overview

• Building a report containing conditional


highlighting
• Building a drill-down report
• Writing to a temporary table from a
report

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
16-26 Oracle Developer: Build Reports
Practice Session Overview: Lesson 16
......................................................................................................................................................

Practice Session Overview: Lesson 16


This practice session contains:
• Building a report containing conditional highlighting
• Building a drill-down report
• Writing to a temporary table from a report

Introduction
In this practice session, you highlight values based on conditional PL/SQL code.
You build a master report that enables you to call a separate report from a button in
the previewer.
If you have time, you add report-level triggers to an existing report to write
messages to a temporary table at various stages of report execution.
Write PL/SQL functions as local PL/SQL (report-level), and reference the code in a
condition within the relevant object trigger in the report.

......................................................................................................................................................
Oracle Developer: Build Reports 16-27
Lesson 16: Using the Report Builder Built-In Package
......................................................................................................................................................

Practice Session: Lesson 16


1 Open report p8q5.rdf.
a Display the column CUST_TOTAL in the customer group as red
bold italics if its value is 10,000 or more.
Hint: Check the help system for the SRW.SET_<attributes> or use
conditional formatting:
Attribute Suggested Values
Text color Red
Font weight SRW.BOLD_WEIGHT
Font style SRW.ITALIC_STYLE

You can import the file p16q1a.txt.


b Alter the pattern and color of those records where the customer total
is 5000 or less.
Hint: Check the help system for the SRW.SET <attributes> or use
conditional formatting.

Attribute Suggested Values

Fill pattern Crisscross, sandpaper

Foreground fill color Yellow

Background fill color Green

You can import the file p16q1b.txt.


c Write the necessary format triggers.
d Save the report as p16q1.rdf.
2 Call a drill-down report using a button.
a Continue with the previous report.
b Alter query Q_2 to include the customer ID, but do not display it in
the report.
c Add a button to this report to display a drill-down report when the
button is chosen at run time. The button should be displayed once for
every customer record.

......................................................................................................................................................
16-28 Oracle Developer: Build Reports
Practice Session: Lesson 16
......................................................................................................................................................

d When the button is chosen, the detail report (p12q1.rdf) is called


with the customer ID as a parameter.
Hint: Have a look at report p12q1.rdf to check the name of the
parameter.
You can import the file p16q2d.txt.
e Save the report as p16q2.rdf.
f Test the report using the run-time executable and then close the run
time.

If You Have Time


3 Open report p9q1.rdf.
In this report, you use report triggers to create a temporary table at the start of
report execution and insert rows into the table at various stages of the execution.
a Write a trigger that creates a temporary table to hold the date and
userid each time the report is run. The table should contain three
columns: one date column, one character column of width 10, and
one character column of width 80.
CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN VARCHAR2(10), COMMENTS VARCHAR2(80))
b The same trigger should also insert the current date, userid, and
“Starting Report” into this table.
INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER, ’Starting Report’)
Hint: Think about how you code the single quotes.
c Save the report as p16q3.rdf.
d Compile the PL/SQL and run the report. Make sure that you view
more than one page.
e Run and test the report.
f Using SQL*Plus, verify that your table exists and was populated
successfully.
g Log on to SQL*Plus (in Microsoft Windows, select the SQL*Plus
icon in the Oracle group) using the same userid as you used for
Reports.
h Display all records in the RUNREPORT table.
SQL> col comments format a40
SQL> SELECT * FROM RUNREPORT;

......................................................................................................................................................
Oracle Developer: Build Reports 16-29
Lesson 16: Using the Report Builder Built-In Package
......................................................................................................................................................

i Try running the report more than once. When you run the report a
second time, the table already exists and Report Builder raises an
exception. Make the necessary change to your code so that the report
runs even when the table exists.
j Write a trigger that inserts a record with the comment “Printing
another page” whenever it begins a new page.
k Write a trigger that inserts a record with the comment “Report
completed” when the report finishes.
l Save and run the report. Verify the results in SQL*Plus.

......................................................................................................................................................
16-30 Oracle Developer: Build Reports
17
................................

Maximizing Performance
Using the Reports Server
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

Objectives

At the end of this lesson, you should be


able to do the following:
• Distinguish between local client and
remote server reporting
• Describe the three-tiered architecture of
Report Builder
• View and schedule server-side reports
using the Queue Manager

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-2 Oracle Developer: Build Reports
Overview
......................................................................................................................................................

Overview
Introduction
In this lesson you learn how to control and monitor a remote Reports Server
installation, and how to view and schedule reports sent from a client to the Reports
Server.

Objectives
At the end of this lesson, you should be able to do the following:
• Distinguish between local client and remote server reporting
• Describe the three-tiered architecture of Report Builder
• View and schedule server-side reports using the Queue Manager

......................................................................................................................................................
Oracle Developer: Build Reports 17-3
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

Why Use a Remote Server?

Client reporting
• All processing and
formatting is done on the
client
Suitable for small and
medium size reports
DB
• Everyone runs the same
report again and again, Developer/2000
no sharing
Release 1
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-4 Oracle Developer: Build Reports
Why Use a Remote Server?
......................................................................................................................................................

Why Use a Remote Server?


Introduction
This section compares and contrasts the features of running reports on a local client
and on a remote server.

Formatting Reports on a Local Client


When you run a report on the client, the client machine has to do all the formatting.
For small to medium-sized reports, this processing might not require much time and
effort. However, for large reports, the length of time needed by the client can be
very inconvenient.

Rerunning the Same Report


When running reports locally on the client, several users often run the same report
on their own machine; therefore, the report might run many times, which is
unnecessary if the required output already exists.

......................................................................................................................................................
Oracle Developer: Build Reports 17-5
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

Running Reports on a Remote


Server
Benefits of the Reports
Server (RWMTS60)
• Formats, prints
reports on a powerful RWMTS60
server
• Eliminates rerunning RWRUN60 RWRUN60 RWRUN60

reports
DB DB
• Enhances scalability
and performance Oracle Developer
Release 6
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-6 Oracle Developer: Build Reports
Why Use a Remote Server?
......................................................................................................................................................

Running Reports on a Remote Server


Oracle Reports Release 6 provides a powerful and intelligent Reports Server that
resides on a high performance server machine that is capable of processing and
formatting your reports at high speed and can return the completed output to the
client machine.
The Reports Server is a single process, and dynamically manages a set of report run-
time engines. Each Reports Runtime engine is responsible for executing a single
report at any given time; each engine can reside in memory to execute additional
report requests over a period of time.

Benefits of the Reports Server


• Reports are formatted on a high-performance NT or UNIX server.
• The Reports Server detects duplicate reports. Users can share output without
rerunning the report.
• The Reports Server caches the output in a central repository on the server
machine.
• You can implement multiple run-time engines for one Reports Server.
• You can implement multiple Reports Servers on one machine.

......................................................................................................................................................
Oracle Developer: Build Reports 17-7
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

Reports Server Architecture


(Thin) Client
Queue Manager
RWCLI60 RWRQM60

Application server
(Unix/NT) RWMTS60

RWRUN60 ... RWRUN60 ... RWRUN60

DB
server DB DB
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-8 Oracle Developer: Build Reports
Reports Server Architecture and Configuration
......................................................................................................................................................

Reports Server Architecture and Configuration


Introduction
This section details the three-tiered architecture of remote server reporting and
discusses the commands to invoke a report on the remote server. You also learn how
to install and connect to the Reports Server.

The Three-Tiered Architecture

Client Tier The client tier is a front-end machine that sends commands to the
remote Reports Server.
• Invoke the executable RWCLI60 to schedule a report from the command line.
• Invoke the Queue Manager (RWRQM60) to view and schedule reports.
• Start up the Reports Server manually from the Queue Manager, or start it from
the command line.

Application Tier The middle application tier contains the remote Reports Server,
which can consist of multiple runtime engines.
• You can use multiple Reports Servers to execute reports.
• A Reports Server spawns extra runtime engines as necessary, depending on a
parameter in a server initiation file.
• Each run-time engine dies off when there are no jobs to run and when it has
been idle for a set time.

Database Server Tier The database server resides on a back-end machine. This
can be the same machine as the application tier.
The same Reports Server and the same run-time engine can connect to different
database aliases for each report run.

......................................................................................................................................................
Oracle Developer: Build Reports 17-9
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

Reports Server Clustering


Master Report Multi Tiered
Server Slave Report
Server Servers
Engine Engine
Engine
Engine

Multi Tiered
Server Multi Tiered
Server

Engine Engine
Engine Engine
Engine Engine
Engine Multi Tiered Engine

Server

Engine Engine
Engine
Engine

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-10 Oracle Developer: Build Reports
Reports Server Clustering
......................................................................................................................................................

Reports Server Clustering


Introduction
While the introduction of a multi-tiered server is a benefit in itself, it still only
allows for a single machine to act as the server. In order to scale beyond the bounds
of a single machine, Oracle Reports Release 6 introduces the Reports Server
Clustering feature.

Scalable Load Management


Reports server clustering works as a master-slave configuration. One reports server
is designated to be the master, all other reports servers are slaves. By clustering
individual reports servers they act as a single logical, but distributed, report engine.
When you submit jobs to the Reports Server they are automatically routed to an
available engine running on any machine within the cluster. If your reporting
demands grow to the extent where performance is degrading, it is simply a matter of
adding a new machine to the cluster to extend the available processing power.
When you add machines to the cluster, the Report Server automatically recognizes
their existence and starts to issue job requests to them. In case one of the machines
becomes unavailable due to failure or shutdown, the server automatically ceases to
issue requests. If an engine dies while running a job, the job is resubmitted using the
retry mechanism—there is no guarantee that it will run on the same slave however.

Optimizing Resources
The master server performs duplicate job and tolerance checks before a job is
allocated. If it receives a duplicate request within a defined time period, the job is
serviced from the cache rather than by re-executing it.

Running a Report
In a Report Server Cluster you run a report by specifying server=master_name in
the command line for the client executable. The master server then assigns
incoming jobs to the engines on the slave servers.

......................................................................................................................................................
Oracle Developer: Build Reports 17-11
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

Parameters for RWCLI60


• SERVER = <master_server>
• MODULE|REPORT = <runfile>
• DESTYPE = FILE, PRINTER, MAIL,
CACHE, LOCALFILE, SYSOUT
• DESNAME = <desname>
• DESFORMAT = PDF, DFLT, HTML,
HTMLCSS, RTF, DELIMITED
RWCLI60.EXE
RWCLI60.EXE SERVER=masterserver
SERVER=masterserver
MODULE=my_rep.rdf
MODULE=my_rep.rdf DESTYPE=FILE
DESTYPE=FILE
DESNAME=my_rep.pdf
DESNAME=my_rep.pdf DESFORMAT=pdf
DESFORMAT=pdf
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-12 Oracle Developer: Build Reports
Reports Server Clustering
......................................................................................................................................................

Parameters for Running a Remote Report


• RWCLI60 sends a request to the Reports (master) server.
• RWCLI60 is invoked by a Common Gateway Interface (CGI) script. There is a
CGI version available for Web servers (RWCGI60).
• SERVER=<tnsname>, where <tnsname> is an alias for your Report Server that
you create in <oracle_home>\net80\admin\tnsnames.ora. We discuss the
Reports Server name and parameters later in this lesson.
• You cannot set DESTYPE to Screen or Preview when using RWCLI60.
• HTMLCSS uses cascading style sheets, available in Netscape 4.0 or higher.
Note: RWCLI60 accepts the same parameters as the Reports Runtime, RWRUN60.

Running a Remote Report from the Command Line

Example
1 Invoke the command line. In Windows NT, Choose Start—>Run.
2 Enter the command string, for example:
RWCLI60.EXE SERVER=masterserver REPORT=my_rep.rdf DESTYPE=FILE
This command sends the report to the remote master server, and the report runs
immediately.

Returning Control to the Client


Include BACKGROUND=yes in your RWCLI60 command line, and then
RWCLI60 returns immediately after submitting a job request to the Reports Server.

......................................................................................................................................................
Oracle Developer: Build Reports 17-13
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

The Schedule Parameter

SCHEDULE = [FREQ from] TIME [retry n after LEN]

RWCLI60...
SCHEDULE=monthly_last_weekday_from_17:00_Oct_23,_1999_
retry_3_after_1_hour

FREQ CLOCK DATE

TIME
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-14 Oracle Developer: Build Reports
Reports Server Clustering
......................................................................................................................................................

The Schedule Parameter


SCHEDULE is a scheduling parameter that you can include in the RWCLI60
command line to control the time and frequency with which your report runs.
The syntax of the SCHEDULE parameter comes primarily from the syntax of a
“cron” job on UNIX. To avoid quoting the schedule string, use underscores (_)
instead of spaces.
In default mode the program runs the report immediately.

Syntax
The full syntax of the SCHEDULE parameter is: [SCHEDULE=] string
where the string is: [FREQ from] TIME [retry {n} + after LEN]
FREQ = hourly|daily|weekly|monthly|{every LEN|DAYREPEAT}|{last {WEEKDAYS|
weekday | weekend} before {n}+}
TIME = CLOCK [DATE] [INCR]
CLOCK = <hh:mm>
DATE=<calendar date>
INCR = {+LEN} | {next SUFFIX}
LEN = {n} * SUFFIX
SUFFIX = <time, date, FREQ>

Example
SCHEDULE=hourly_from_09:00am_May_01,_1999
SCHEDULE=last_weekday_from_17:00_Oct_23,_1999_retry_3_after_1_hour
Note: This syntax is necessary only if you want to control your report jobs from the
command line. You can also specify the scheduled time and frequency of a report
when you define a new job in the easy-to-use Queue Manager screen, which we use
later in this course.

......................................................................................................................................................
Oracle Developer: Build Reports 17-15
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

Reports Caching

Cached reports on server:


• Tolerance = n (minutes)
• Tolerance = 0 (default/current behavior)
• Maximum tolerance is 232 minutes
(approximately 10,000 years)
• Cached output controlled by a server
parameter CACHEDIR

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-16 Oracle Developer: Build Reports
Reports Server Clustering
......................................................................................................................................................

Reports Caching
Include the TOLERANCE parameter in your command line to cache the report
output for a specified number of minutes.
Setting TOLERANCE=60 means that the Reports Server can detect a duplicate
report request from the same userid, and return the existing cached output to the
client without rerunning the report if the existing report output is 60 minutes old or
less.
Setting TOLERANCE=0 forces the report to rerun for each request. This is the
default behavior.

Cached Output
The Reports Server uses a parameter CACHEDIR to determine where to place the
cached output.
The default directory is <oracle_home>\report60\server\cache.

......................................................................................................................................................
Oracle Developer: Build Reports 17-17
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

Reports Server Configuration


Parameters

Installing a Reports Server on Windows NT


• Service example (normal)
RWMTS60 -install my_server tcpip

• Non-service (less common)


RWMTS60
RWMTS60 -listen
-listen my_server
my_server INITENGINE=2
INITENGINE=2 MINENGINE=1
MINENGINE=1

Command line values override server


.ora file

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-18 Oracle Developer: Build Reports
Reports Server Clustering
......................................................................................................................................................

Reports Server Configuration Parameters


When you first install a Reports Server, it creates a .ora file with the same name as
the server. The file exists in <oracle_home>\report60\server, and you can edit
the parameters in the file.
You can start up the Reports Server manually as a nonservice; however, on
Windows NT it is more common to install the server as a service.
• Service: All parameters have default values that you can modify in the server
.ora file.
• Nonservice: You can initialize some parameters on the command line when you
start up the server.

Server File Contents


The following parameters exist in the <server>.ora file, and are also available on
the command line, if installing manually as a nonservice:

Parameter Description
NAME A server name that exists in TNSNAMES.ORA file
INITENGINE Number of run-time engines running after you invoke Reports Server
MINENGINE Minimum number of engines running per server at any time; default = 0
MAXENGINE Maximum number of engines running per server at any time; default = 1
MAXIDLE Maximum time for an engine to remain idle before it is shut down;
default = 30 (minutes)

......................................................................................................................................................
Oracle Developer: Build Reports 17-19
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

Reports Server Configuration


Parameters
server_name.ORA file in
<oracle_home>\report60\server
MAXCONNECT=20
CACHEDIR="C:\ORANT\REPORT60\server\cache"
CACHESIZE=50
SOURCEDIR="C:\develop\reports"
INITENGINE=1
MINENGINE=1
MAXENGINE=3
MAXIDLE=30
SECURITY=1
ENGLIFE=200
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-20 Oracle Developer: Build Reports
Reports Server Clustering
......................................................................................................................................................

Reports Server Configuration Parameters


Additional <servername>.ora parameters:

Parameter Description
INTERACTIVE Enable Reports Server to send output to screen/preview (Y or N)
MAXCONNECT Number of Reports Server connections and number of ISV connections
SOURCEDIR Directory that Reports Server initially searches for source (.rdf,
.rep) file

CACHEDIR Output directory of cached report


CACHESIZE Size determines how big cache can be
TEMPDIR Directory that Reports Server uses for temporary filespace; if not spec-
ified, default = REPORTS30_TMP path
SECURITY Level of access, 0 to 3, for accessing cached output files through Queue
Manager; 0 = anyone, 1 = same userid, 2 = same process, 3 = none,
default = 1
ENGLIFE Maximum number of reports run before engine shuts down and is
replaced; default = 200

Log File Contents A <servername>.log file in the same directory contains an


administrative actions log, which includes the following information:
• Shutdown time
• Startup time
• Engine start and stop time

How Parameters Control Run-Time Engines


To conserve application server resources, excess or idle report engines remove
themselves from memory for one of the four following reasons:
• When an engine is idle for a [MAXIDLE] period of minutes, an engine removes
itself from the process table and frees up any associated resources.
• When an engine has run its [ENGLIFE] number of jobs, the reports engine dies
gracefully, to be replaced by another engine.
• In response to changes to the maximum number of engines [MAXENGINE],
excess engines are removed.
• When the multitiered Reports Server shuts down.

......................................................................................................................................................
Oracle Developer: Build Reports 17-21
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

Configuring a Clustered Reports


Server: Example
Add to master_name.ora configuration file

clusterconfig=“(server=nt-2
minengine=0
maxengine=2
initengine=2
cachedir=“H:\Cache”)
(server=sun-1
minengine=0
maxengine=2
initengine=2
cachedir=“/share/Cache”)”

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-22 Oracle Developer: Build Reports
Reports Server Clustering
......................................................................................................................................................

Configuring a Clustered Reports Server


Reports Server clustering works as a master-slave configuration. You designate a
server to be the master by adding the following line in the servername.ora
configuration file:
clusterconfig=”(server=server_name
minengine=minimum number of master engines
maxengine=maximum number of master engines
initengine=initial number of master engines
cachedir=directory for central cache)
Note: You need an entry for each slave server.
The next thing you do is to ensure that the master can see the slaves, and that the
slaves can see the master:
• Add a line to the master tnsnames.ora file for each slave:
slave_name.world=(ADDRESS=(PROTOCOL=tcp)(HOST=slave_name)(PORT=1949
))
• Add a line to the slave tnsnames.ora file to identify the master”
master_name.world=(ADDRESS=(PROTOCOL=tcp)(HOST=master_name)(PORT=1949))

Technical Note
The Reports Server requires Oracle Net8. When installing Report Builder, the
Installer knows this is a dependency and installs it if necessary.
Reports supports the following protocols: NAMED PIPES, and TCP/IP.
If you have a sqlnet.ora file with a default domain, you must make sure that you
specify the domain in your tnsnames.ora file when entering the server name. For
example, my_server.world=(). Alternatively, if you do not use your sqlnet.ora
file, remove or rename it.

......................................................................................................................................................
Oracle Developer: Build Reports 17-23
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

What Is the Queue Manager?

Real-time Reports Server status


• View report status and scheduled jobs
• Refresh to see the up-to-date status
• Reprioritize or cancel jobs

• Administrator password encrypted in


.ora file
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-24 Oracle Developer: Build Reports
Viewing and Scheduling Reports in the Queue Manager
......................................................................................................................................................

Viewing and Scheduling Reports in the Queue Manager


Introduction
This section explains the features of the Queue Manager and how to use it to view
and schedule reports in an easy-to-use GUI interface.

What Is the Queue Manager?


The Queue Manager is a facility that enables users and administrators to view the
current status of each report.
You can see all the jobs controlled by the master, as well as the server on which each
job is running, and the time that each report started and finished and whether it
terminated successfully or with an error.
You can also view jobs that are scheduled to run at a future date or time.
You can reprioritize or cancel your own scheduled jobs. Administrators can
reprioritize or cancel any scheduled jobs.

Administrator Privilege
In the <servername>.ora file, the first line gives an encrypted password,
IDENTIFIER=.
You can set this password the first time that you start the Reports Server. At the
login prompt, choose any username and password to assign as Administrator.

......................................................................................................................................................
Oracle Developer: Build Reports 17-25
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

Queue Manager
Past jobs
Current jobs
Scheduled jobs

Copyright  Oracle Corporation, 1999. All rights reserved.

Queue Manager
All my jobs
All jobs
Refresh

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-26 Oracle Developer: Build Reports
Viewing and Scheduling Reports in the Queue Manager
......................................................................................................................................................

Viewing Report Jobs


The Queue Manager status bar enables you to switch between different views of
report jobs.

Icon Name Description


Show Past Jobs Displays jobs that have already run for a given Reports Server
Show Current Jobs Displays jobs that are currently running
Show Scheduled Jobs Displays scheduled jobs in order to reprioritize or cancel a job

Viewing Different Owners’ Jobs


The Queue Manager status bar enables you to restrict the view of jobs by owner.

Icon Name Description


Show all My Jobs Displays your reports for a given Reports Server
Show all Jobs Displays all reports for a given Reports Server

Displaying Up-to-Date Job Status


Choose Refresh on the status bar to refresh the screen and display the up-to-date
status.
The default update interval is 15 seconds. You can alter this interval in the Queue
Manager preferences screen:
Options—>Preferences—>Polling Interval

......................................................................................................................................................
Oracle Developer: Build Reports 17-27
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

Using the Queue Manager


RSVR1
Queue
Manager RSVR2

• Connect to any number of servers


• Administrator can shut down server
• Reports Server restores scheduled jobs
after shutdown

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-28 Oracle Developer: Build Reports
Viewing and Scheduling Reports in the Queue Manager
......................................................................................................................................................

Connecting to a Reports Server


You can connect to any Reports Server by changing the server name in the Queue
Manager status bar.

Shutting Down a Reports Server


You can shut down the Reports Server from the Queue Manager menu if you have
Administrator privileges:
Queue—>Shutdown
This option remains grayed out if you are not logged on as administrator.

Retaining Scheduled Jobs After Shutdown


The Reports Server maintains a list of all scheduled jobs in a file, <oracle_home>/
report60/server/<servername>.dat. If the Reports Server shuts down and
restarts for any reason, it reads this file at startup and restores all scheduled jobs.

......................................................................................................................................................
Oracle Developer: Build Reports 17-29
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

Reports Server ActiveX Control


• Embed in any ActiveX container
• Run report with a call to RWRBE60 or
RWMTS60

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-30 Oracle Developer: Build Reports
Viewing and Scheduling Reports in the Queue Manager
......................................................................................................................................................

The Reports Server ActiveX Control


The Oracle Developer installation provides an ActiveX control, which you can use
from other Windows applications to invoke the remote Reports Server and schedule
your reports.
The ActiveX control is RWSXU60.OCX. This control displays the Queue Manager.
You can embed this control in any ActiveX container.

Remote or Local Remote Reporting The ActiveX control can run a report by a
synchronous or an asynchronous call to the remote Reports Server; it can also run a
report by calling the Reports Background Engine.

......................................................................................................................................................
Oracle Developer: Build Reports 17-31
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

Summary
Reports Server provides:
• Increased efficiency and scalability
• Three-tiered architecture
• Reports client (RWCLI60)
• Reports Server (RWMTS60)
• Reports caching
• Status and rescheduling (RWRQM60)
• ActiveX control for other applications

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-32 Oracle Developer: Build Reports
Summary
......................................................................................................................................................

Summary
The new remote Reports Server provides increased efficiency, scalability and
distributed capabilities for large reports.
The Queue Manager provides an easy-to-use GUI for viewing and scheduling report
jobs.
By caching report output, you can ensure that users do not rerun common reports
unnecessarily.
You can embed the Reports Server ActiveX control in other Windows applications
to run and schedule reports.

......................................................................................................................................................
Oracle Developer: Build Reports 17-33
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

Practice 17 Overview

• Running a report on your local machine


• Running reports on a remote server
using the Queue Manager
• Copying output from a remote server to
your local machine
• Running a report on a remote server
using the command line

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
17-34 Oracle Developer: Build Reports
Practice Session Overview: Lesson 17
......................................................................................................................................................

Practice Session Overview: Lesson 17


This practice session contains:
• Running a report on your local machine
• Running reports on a remote server using the Queue Manager
• Copying output from a remote server to your local machine
• Running a report on a remote server using the command line

Introduction
In this practice session you run a report locally and then on a remote server, using
the Queue Manager. You also use the Queue Manager to view the submitted jobs.
If you have time, you can submit a report to a remote server using the command line
options.

......................................................................................................................................................
Oracle Developer: Build Reports 17-35
Lesson 17: Maximizing Performance Using the Reports Server
......................................................................................................................................................

Practice Session: Lesson 17


1 Run longrun1.rdf on your local client machine.
aOpen longrun1.rdf and run the report. Notice the time it takes for
the report to run to completion. If it has not completed within five
minutes, note how many pages have been formatted, then cancel the
report.
Note: Change Destination Type to File in the run-time parameter
form when running this report.
2 Run longrun1.rdf and longrun2.rdf by calling the Reports Server from the
Queue Manager.
Note: Your instructor will give you specific instructions to complete this
exercise. The location of the remote server, directory paths, and so on, might
differ for your class.
a Invoke the Queue Manager. Enter repserver1 as your server
name. Note if there are any jobs in the queue.
b Schedule a new job to run longrun1.rdf report on the Reports
Server. Choose applicable settings from the tab pages of the Queue
Manager. For Destination Type, choose ToLocalFile, ToFile, or
Cache; the report default is Screen, which is not valid when running
a remote report.
c Do the same for longrun2.rdf.
d Display all jobs to see where your jobs are queued in relation to the
reports of other students.
e Display all your own jobs only.
f Refresh the screen several times to see how quickly the report pages
are formatted.
g Cancel your own longrun2.rdf from the server queue.
3 When the report longrun1.rdf has finished, copy the output to a filename,
longrun1.pdf, in your home directory.

If You Have Time


4 Run longrun1.rdf by scheduling a new job from the command line.
a Using RWCLI60 from the command line, submit your
longrun1.rdf report to the Reports Server.
b Ensure the output is in PDF format and that it is cached.

......................................................................................................................................................
17-36 Oracle Developer: Build Reports
18
................................

Building Reports for


Different Environments
Lesson 18: Building Reports for Different Environments
......................................................................................................................................................

Objectives

At the end of this lesson, you should be


able to do the following:
• Build reports for different GUIs
• Build character mode reports
• Build reports to run in other languages

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
18-2 Oracle Developer: Build Reports
Overview
......................................................................................................................................................

Overview
Introduction
Oracle Developer applications are portable across multiple platforms and multiple
languages. You can reduce cross-platform development effort by planning for
platform-specific features or restrictions. In this lesson you learn how to build
reports to run on various platforms, and in different environments and languages.

Objectives
At the end of this lesson, you should be able to do the following:
• Build and run reports in different environments using the MODE parameter
• Describe the considerations when building reports for different graphical user
interfaces (GUIs)
• Recognize the settings necessary to build character mode reports
• Describe the facilities available for building reports to run in other languages

......................................................................................................................................................
Oracle Developer: Build Reports 18-3
Lesson 18: Building Reports for Different Environments
......................................................................................................................................................

Different Development and


Runtime Environments

Report Builder development


• Bitmapped only
Report Builder Run-time
• Bitmapped MODE = bitmap
• Character mode MODE = character

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
18-4 Oracle Developer: Build Reports
Different Development and Run-Time Environments
......................................................................................................................................................

Different Development and Run-Time Environments


Introduction
Although you always develop your reports in a bitmapped environment, the
production reports can run in either bitmapped or character mode.
Therefore you can develop a report in a bitmapped environment that is to run in a
character mode environment.

Bitmapped Environment
This environment has a unit of pixel and typically supports a mouse. Interaction
with the host computer is continuous.
The bitmapped Designer allows you, as a developer, to take advantage of the
graphical user interface.

Character Mode Environment


This environment has a unit of character, typically 80x24, and rarely supports a
mouse. Interaction with the host computer is at field level; that is, when the user
navigates from the field.
A report that runs in character mode cannot display any graphics features, such as
images, drawings, or multimedia objects.

Running a Character Mode Report from the Builder


You can test your character mode reports very easily in the bitmapped Report
Builder and view the report output in the Previewer.
The execution of the report as bitmapped or character simply depends on a system
parameter called MODE. You can change this parameter in Report Builder, to test
the character output during your report development.

......................................................................................................................................................
Oracle Developer: Build Reports 18-5
Lesson 18: Building Reports for Different Environments
......................................................................................................................................................

Developing Reports to Run in


Different GUIs

• Use common fonts or map fonts in


uifont.ali
• Use common colors
• Beware of DPI (dots per inch)

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
18-6 Oracle Developer: Build Reports
Developing Reports to Run in Different GUIs
......................................................................................................................................................

Developing Reports to Run in Different GUIs


Introduction
There are a few points that you should consider when moving a report from one
GUI to another, because the following GUI differences may affect the report output.

Use Common Fonts


If possible, use fonts that you know exist on the target GUI; otherwise, remember to
set up your font alias file so that the fonts that you use during development map to
existing similar fonts on the target GUI.

Example
In the uifont.ali file on Microsoft Windows, map Motif and Mac fonts to
Microsoft Windows:
/* Motif fonts */
lucidatypewriter= ”Courier New”
lucidabright= ”Times New Roman”
fixed = ”Courier New”

/* Mac fonts */
”Avant Garde”= ”Arial”
”New York”= ”Times New Roman”
In the uifont.ali file on UNIX (motif), map Microsoft Windows fonts to Motif:
/* Microsoft Windows fonts */
”Courier New” = lucidatypewriter
”Times New Roman”= lucidabright

Use Common Colors


If possible, use a color that you know exists on the target GUI; otherwise, use one
that maps well to the default color of the target GUI.

Beware of Dots Per Inch


The dots per inch (DPI) may differ between machines, even if they both use the
same GUI. This only affects how alphanumeric characters wordwrap on the screen.
Therefore, if you design a report that is displayed in the previewer, try to use the
same DPI as the users who will eventually run the report.

......................................................................................................................................................
Oracle Developer: Build Reports 18-7
Lesson 18: Building Reports for Different Environments
......................................................................................................................................................

Building Character Mode


Reports
• Use predefined character mode
template
• Modify report properties
• Avoid GUI objects: graphics, buttons,
OLE2
• Avoid borders

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
18-8 Oracle Developer: Build Reports
Building Character Mode Reports
......................................................................................................................................................

Building Character Mode Reports


Introduction
Because of the difference between GUI and character mode environments, and
because of the limitation of character mode, consider the following points during
development.

Set Report-Level Properties


Define character mode settings before creating any part of your report layout, in
preparation for running in character mode. There are two methods:
• Select the character mode template in the Report wizard. This is the simplest
method. You can copy and modify the template to create character-mode
templates with different settings.
• Open the report property palette and modify the character mode settings.
Always select Use Character Units in Designer when developing character
reports.

Avoid Graphics, Buttons, and OLE


Avoid using graphic objects. When executing a report in character mode, Report
Builder converts all boilerplate objects (except rectangles, lines, and text) to
rectangles, as well as any field with a nontext source (for example, a file column
referencing a multimedia file) and any Graphics Display.
To include graphics, you can choose to show the area that contains a graphic object
by selecting the Convert Bitmapped Objects to Boxes check box in the Character
Mode tab of report properties. This option displays an empty rectangle with a border
in place of the graphic object.

Avoid Borders
Border behavior differs between the environments. If you must use borders in
character mode reports, select the Convert Borders check box under the character
mode in the report property palette. This option displays borders in the Layout
editor more effectively.

......................................................................................................................................................
Oracle Developer: Build Reports 18-9
Lesson 18: Building Reports for Different Environments
......................................................................................................................................................

Building Character Mode


Reports
Also consider:
• Font
• Color
• Fill patterns
• Format attributes
• Printer codes

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
18-10 Oracle Developer: Build Reports
Building Character Mode Reports
......................................................................................................................................................

Font
Before creating any layout, choose a font that converts successfully to
ASCII/EBCDIC characters, such as Courier. The character template provides a
suitable font.
Text styles of Underline, Inverted, and Blink convert to character mode attributes
Underline, Reverse Video, and Blink, but only if you use a character mode terminal
definition that supports those attributes. Similarly, the text weight of Medium may
convert to bold.

Color
Avoid the use of color; Report Builder assigns colors to fill patterns.

Fill Patterns
Avoid the use of fill patterns; a transparent fill successfully converts to a character
mode transparent fill, but all other fill patterns convert to a solid fill.

Format Attributes
Only certain mask attributes apply in character mode when using the
SRW.SET_ATTR procedure. Report Builder ignores bitmapped codes when
running the report in character mode, and vice versa. You can therefore include both
bitmapped and character mode attributes in the same report if you want it to run in
both environments.

Printer Codes
You can include printer codes in your reports in preparation for running in character
mode; Report Builder ignores the codes if you run the report in bitmapped mode.

......................................................................................................................................................
Oracle Developer: Build Reports 18-11
Lesson 18: Building Reports for Different Environments
......................................................................................................................................................

Setting NLS Language


Environment Variables
• NLS_LANG
• DEVELOPER_NLS_LANG,
USER_NLS_LANG

NLS_LANG=French_France.WE8DEC
NLS_LANG=French_France.WE8DEC

• UNICODE
NLS_LANG=<lang>_<territory>.AL24UTFFSS
NLS_LANG=<lang>_<territory>.AL24UTFFSS

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
18-12 Oracle Developer: Build Reports
Building Reports to Run in Different Languages
......................................................................................................................................................

Building Reports to Run in Different Languages


Introduction
This section gives a brief overview of the features in Oracle and
Oracle Developer that provide support for building multilingual applications:
• Switching languages using Oracle’s National Language Support (NLS)
• Translating an application using Translation Builder

Setting NLS Language Environment Variables


Three language environment variables are available:
• NLS_LANG
• DEVELOPER_NLS_LANG
• USER_NLS_LANG
DEVELOPER_NLS_LANG and USER_NLS_LANG take the same parameter as
NLS_LANG. Use them as an alternative to NLS_LANG when you need to use two
sets of resource and message files at the same time; for example, if you prefer to
develop using English but need to build an application in another language.

Syntax NLS_LANG = <language>_<territory>.character_set


• Language: Language conventions for displaying messages and day and month
names
• Territory: Conventions for default date format, and for displaying currency,
decimal, and thousands symbols
• Character_set: Character set in which data is displayed

Example NLS_LANG=French_France.WE8DEC

Using Unicode in Oracle Developer


Unicode (UCS-2) is a fixed-length two-byte character set that represents up to
65,536 characters.
Using Unicode in Oracle Developer enables you to display multiple languages in
one application without switching character sets.

Syntax
NLS_LANG = <language>_<territory>.AL24UTFFSS

......................................................................................................................................................
Oracle Developer: Build Reports 18-13
Lesson 18: Building Reports for Different Environments
......................................................................................................................................................

Translating a Developer/2000
Application
Use Translation Builder to:
• Extract strings; import into repository
• Execute translation
• Merge back into original resource
Consider:
• Format masks
• Hardcoded strings
• Multiple character sets
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
18-14 Oracle Developer: Build Reports
Building Reports to Run in Different Languages
......................................................................................................................................................

Translating an Oracle Developer Application


Translation Builder is a component of Oracle Developer that supports and manages
translations of text extracted from both Oracle resource files, such as Oracle
Developer applications, and non-Oracle resource files such as Microsoft Windows
(.rc) and HTML files.
You can translate a report from any language to any other language. Once a
translation is complete, you can use that translation as a base for further translations.
Translations are portable across multiple platforms.

How to Translate a Resource


1 Use the Project Navigator to extract translatable strings from Oracle or
non-Oracle resources and import them into the translation repository.
2 Add a translation by indicating the language.
3 Execute the translation using the Translation editor.
4 Preview the translation by performing appearance checking and tuning to
preserve an acceptable look and feel.
5 Extract the translated strings and merge them back into the original resource.

Considerations When Designing Multilingual Applications


• Format masks: Make sure to provide extra space for translation of date and
numeric format masks.
• Text strings: Avoid hardcoding a string containing language-specific words such
as a month name.
• Character sets: If using an application that will run with multiple character sets,
determine the one that is most frequently used and generate the application files
with the relevant NLS language settings.

......................................................................................................................................................
Oracle Developer: Build Reports 18-15
Lesson 18: Building Reports for Different Environments
......................................................................................................................................................

Summary

• GUIs:
Colors, uifont.ali
• Character mode:
Templates, report properties, MODE
parameter
• Languages:
NLS, Unicode, Translation Builder

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
18-16 Oracle Developer: Build Reports
Summary
......................................................................................................................................................

Summary
• Building reports to run on different GUIs:
- If reports must run on different GUIs, remember to use common features,
such as the common color names.
- Use uifont.ali to map different fonts if necessary.
• Building character mode reports:
- Use the character template.
- Copy the template and rename it to create several templates with different
settings, such as page sizes.
- Use the MODE parameter to switch from bitmap to character mode.
• Building reports to run in different languages:
- Oracle Developer provides National Language Support.
- Oracle Developer provides Unicode support to handle multiple character
sets in one application.
- Translation Builder supports and manages translations of extracted text
strings.

......................................................................................................................................................
Oracle Developer: Build Reports 18-17
Lesson 18: Building Reports for Different Environments
......................................................................................................................................................

......................................................................................................................................................
18-18 Oracle Developer: Build Reports
A
................................

Solutions
Appendix A: Solutions
......................................................................................................................................................

Practice Session Overview: Lesson 1


Introduction
This practice familiarizes you with Oracle Developer by asking you a
number of questions that you answer by navigating through the interface and
by investigating Help Topics.
After each question, space is provided for you to write the answer. Or, if you
prefer, use a separate sheet of paper.
Depending on the size of your group, the instructor might ask you to answer
some of the questions and share your answers with the rest of the class.
Depending on the environment you are using in this course, the instructor
might ask you to compile some reports from the Project Builder.

......................................................................................................................................................
A-2 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 1
......................................................................................................................................................

Practice Session Solutions: Lesson 1


1 Launch Report Builder and then choose Cancel in the wizard.
Choose Report Builder in the launcher.
When Report Builder is up, choose Cancel in the wizard.
2 Change your preferences so that a newly opened report is not
immediately executed. To do this you must suppress the Report editor on
Open.
Select Tools—>Preferences from the menu. On the General tab,
select the option Suppress Report Editor on Open and then choose
OK.
3 Open the report named p2q2.rdf.
Choose Open from the toolbar or File—>Open from the menu and
then select the file named p2q2.rdf.
4 Change your preferences so that you can work with a report definition
either in a file or the database. Ensure that the default list shows only
reports.
Select Tools—>Preferences from the menu. On the Access tab select
the option File/Database and check Reports. Notice that the select in
All is cleared. Choose OK to accept your preferences.
5 Open another report: p2q3.rdf. Notice the additional dialog box.
Choose Open from the toolbar or File—>Open from the menu.
Accept the dialog box. In the File Browse dialog box, select the file
named p2q3.rdf and choose OK.
6 Reset your preferences to work with files only. Enable a report to be run
automatically on open.
Select Tools—>Preferences from the menu. On the General tab clear
the option Suppress Report Editor on Open. On the Access tab
select the option File. Choose OK to accept your preferences.

......................................................................................................................................................
Oracle Developer: Build Reports A-3
Appendix A: Solutions
......................................................................................................................................................

7 Use the context-sensitive Help to discover more about preferences.


Select Tools—>Preferences from the menu. Choose Help or press the
Help key (F1 on Windows systems).
General:
a What setting must you choose for color mode if you want to alter the
color palette for a specific report?
Choose the General tab in the Help system. In the dialog box,
select Color Mode and choose Display.
You must set the color mode to Editable.
b What menu option do you use to alter the color palette?
Format—>Layout Options—>Color Palette.
Close the Help system.
Run-time values:
Go back into the Tools—>Preferences Help system.
c What is the purpose of the Runtime Values?
Choose the Runtime Values tab in the Help system.
Run-time values are values used if you run your report in the
current session.
d When do they take effect?
Immediately
e What must you do to change the default setting in your report?
You must update the Initial Value of the appropriate parameter
in the report definition.
f What are the names of the three run-time values that affect the report
destination, and what are the three related report parameters?
Destination Format DESFORMAT
Destination Name DESNAME
Destination Type DESTYPE

Close the Help system and leave the Preferences dialog box.

......................................................................................................................................................
A-4 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 1
......................................................................................................................................................

8 Use Help Topics to discover more about the functionality of Oracle


Developer Report Builder:
Choose Help—>Report Builder Help Topics from the menu.
a What is MAPI?
Use the index to look for MAPI. Choose MAPI, about.
MAPI is the Microsoft Messaging Application Program
Interface used to send reports to an e-mail system.
b What are the prerequisites for sending a report as an e-mail
attachment?
You must have an appropriate MAPI mail client.
c The report is sent as what type of attachment format?
Bitmapped reports are sent as PostScript files, character mode
reports as ASCII text.
d What are the three steps to install Oracle Developer demonstrations?
Use the index to look for Demos, Installing.
The three steps are:
1. Install the demo database objects.
2. Install Report Builder Demo fonts.
3. Install Java classes for the Java Reports demo.
9 Use Help on Manuals to answer the following questions in the Oracle
Information Navigator:
Note: In the Information Navigator, choose Tools—>Preferences to
initialize your Web browser. Your instructor will tell you which browser
to use.
Choose Help—>Manuals from the menu.
a What are the three top-level folder names for the online manuals?
Oracle Developer: Guidelines for Building Applications 6.0
Oracle Developer: Getting Started 6.0
Configuring the Oracle Developer Server 6.0I

......................................................................................................................................................
Oracle Developer: Build Reports A-5
Appendix A: Solutions
......................................................................................................................................................

b In the Getting Started Manual, what are the five topics included in
Administrative Procedures?
Expand the node Oracle Developer: Getting Started in the
Oracle Information Navigator.
Choose Oracle Developer: Index.
Go to Administrative Procedures.
The five topics are:
Building Oracle Developer Database Tables
Using the Database Tables
Granting and Revoking User Access
Deleting the Oracle Developer Database Tables
Upgrading the Oracle Developer Database Tables
c In Designing Portable Applications, what is the purpose of section
6.3?
Expand the node Oracle Developer: Guidelines for Building
Applications in the Oracle Information Navigator.
Choose Designing Portable Applications.
Section 6.3 discusses developing a report for maximum
portability.
d Name the three language environment variables available when
developing multilingual applications.
Choose Oracle Developer: Guidelines for Building Applications
and then choose Index in the Oracle Information Navigator.
Go to Multilingual Applications in the index.
The three environment variables are:
DEVELOPER_NLS_LANG
NLS_LANG
USER_NLS_LANG

......................................................................................................................................................
A-6 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 1
......................................................................................................................................................

10 Use Quick Tour to find out how to prepare a report for the World Wide
Web.
Choose Help—>Quick Tour from the menu.
In the Web browser, choose Report Builder, then choose Preparing a
Report for the World Wide Web.
a What changes do you have to make to your report to deploy it on the
Web?
Page 2 of 9: You can prepare an existing report for the World
Wide Web without making any changes to the report.
b What output formats can you choose from?
Page 4 of 9: You can choose from HTML or PDF output formats.

......................................................................................................................................................
Oracle Developer: Build Reports A-7
Appendix A: Solutions
......................................................................................................................................................

Practice Session Overview: Lesson 2


This practice session contains:
• Invoking the Reports Runtime executable from the Program Manager
• Executing a number of different reports. For each report, answer some questions

Introduction
Before you learn to develop reports in the Builder, you should investigate the run-
time executable that you use constantly in the production environment and for
testing your reports prior to production.
This practice session consists of a combination of practical and paper-based
questions.

......................................................................................................................................................
A-8 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 2
......................................................................................................................................................

Practice Session Solutions: Lesson 2


1 Invoke the Reports Runtime executable.
Choose Reports Runtime from the Oracle Developer menu.
This may differ according to the classroom setup.
2 Run the report called p2q2.rep.
From the menu choose File—>Run. The File Browse window opens.
Select p2q2.rep and choose Open.
a Examine the report in the Previewer window. Among the styles
discussed in this lesson as a reference, what style of report is it?
Tabular report
b How many groups of data are there in this report?
One group of data, each row being displayed once within the
group.
c In the Previewer window, use the scroll bars to move up and down
the report to see all of the data.
Use the scroll bar on the right side of the Previewer to scroll up
and down the report data.
d Close the Previewer window. You are now back in the Runtime
window.
In the Previewer, choose Close Previewer.
3 From the Runtime window, run report p2q3.rep.
From the menu choose File—>Run.The file Browse window opens.
Select p2q3.rep and then choose Open.
a In the Previewer window, move to the next page. Notice that this
report has a header page with text. Notice that the Previewer also has
many more buttons highlighted. This is because there are more
available actions, such as Next Page, Previous Page, Last Page, and
First Page.
Choose Next Page to navigate from one page to another.
b What style of report is this?
Tabular report

......................................................................................................................................................
Oracle Developer: Build Reports A-9
Appendix A: Solutions
......................................................................................................................................................

In the Previewer window, experiment with the horizontal and


c
vertical split screen features.
To split the Previewer horizontally: Choose the small gray area
at the top of the right scroll bar. Keep the left mouse button
down and drag the gray area. As you do this, you see that a thick
dotted line is dragged down the Previewer. Release the left mouse
button when you have reached the desired split point. Now you
have two windows, which work independently from each other.
Move the split bar back to its original position.
To split the Previewer vertically: Choose the small gray area at
the left of the horizontal scroll bar at the bottom of the window.
Keep the left mouse button down and drag the gray area. As you
do this, you see that a thick dotted line is dragged right across
the Previewer. Release the left mouse button when you have
reached the desired split point. Now you have two windows,
which work independently from each other
d Close the Previewer window. You are now back in the Runtime
window.
In the Previewer choose Close Previewer.
4 From the Runtime window, run report p2q4.rep.
From the menu choose File—>Run. The File Browse window opens.
Select p2q4.rep and then choose Open.
a What style of report is this?
It is a Master/Detail report.
b How many groups of data are in this report?
There are two groups of data.
c How many pages are there in this report?
There are three pages. Choose Last Page to navigate to the last
page.
d Close the Previewer window. You are now back in the Runtime
window.
In the Previewer, choose Close Previewer.

......................................................................................................................................................
A-10 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 2
......................................................................................................................................................

5 From the Runtime window, run report p2q5.rep


From the menu choose File—>Run.The File Browse window opens.
Select p2q5.rep and choose Open.
a What style of report is this?
It is a Matrix report.
b How many groups of data are in this report?
There are four groups of data:
Year
Department
Job Title
Salary
There actually is an additional, invisible “cross product” group
around Year, Department, and Job; this special group defines the
matrix structure and is explained in the lesson on matrix reports.
c Close the Previewer window. You are now back in the Runtime
window.
In the Previewer choose Close Previewer.
6 From the Runtime window, run report p2q6.rep.
From the menu choose File—>Run. The File Browse window opens.
Select p2q6.rep and choose Open.
a Notice the Parameter Form. You are requested to input a customer
ID. The report will display order information based on your input.
b Specify a valid customer ID and run the report. Valid values include
201, 210, and 213; choose one of these and then choose Run Report.
Click in the Customer ID field and enter one of the suggested
numbers. Choose Run Report.
c What do you think would be a better method of providing valid
values to a user?
It would be more user-friendly to display a list of values for the
Customer IDs. You could even make the list more meaningful by
adding the customer names. This can be built into the report. In
later lessons you will see how this can be implemented.

......................................................................................................................................................
Oracle Developer: Build Reports A-11
Appendix A: Solutions
......................................................................................................................................................

d Close the Previewer window. You are now back in the Runtime
window.
In the Previewer, choose Close Previewer.
e Run the report again. This time do not specify a customer ID.
From the menu choose File—>Run. The File Browse window
opens. Select p2q6.rep and choose Open, then immediately
choose Run Report without entering a value for customer ID.
i What is the result?
The result is that the report does run; however, it does not display any
data. There are no NULL customer IDs.
ii In a production situation, what should happen in this instance?
The user should be prevented from entering a NULL value or a blank.
In later lessons you will see how this can be implemented.
f Close the Previewer window. You are now back in the Runtime
window.
In the Previewer, choose Close Previewer.
g Run the report again. This time enter Customer ID 999.
From the menu choose File—>Run. The File Browse window
opens. Select p2q6.rep and choose Open. Enter the customer ID
999 and choose Run Report.
i What is the result?
The result is that the report does run; however, it does not display any
data. There is no customer ID 999.
ii In a production situation, what should happen in this instance?
The user should be prevented from entering an invalid value. In later
lessons you will see how this can be implemented.
h Close the Previewer window. You are now back in the Runtime
window.
In the Previewer, choose Close Previewer.

......................................................................................................................................................
A-12 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 2
......................................................................................................................................................

7 From the Runtime window, run report p2q7.rep.


From the menu choose File—>Run. The File Browse window opens.
Select p2q7.rep and choose Open.
a In the Parameter Form notice the list of values for the Customer
information. The report displays order information based on your
input.
b Select a valid customer name and run the report.
Select a customer name from the list of values for customer.
Close the Previewer window. You are now back in the Runtime
window.
In the Previewer, choose Close Previewer.
8 From the Runtime window, run report p2q8.rep.
From the menu choose File—>Run. The File Browse window opens.
Select p2q8.rep and choose Open.
a What do you notice that is different about this report?
A button is displayed to the right of the customer information.
b Choose Details. Another report is called to display information about
the orders the customer has placed with the company. This is called a
Drill-Down report.
c Close the Orders Report Previewer window and then close the
Customer Report Previewer window. You are now back in the
Runtime window.
In the Orders Report Previewer choose Close Previewer.
In the Customer Report Previewer choose Close Previewer.
d Exit Reports Runtime.
From the menu choose File—>Exit.

......................................................................................................................................................
Oracle Developer: Build Reports A-13
Appendix A: Solutions
......................................................................................................................................................

Practice Session Overview: Lesson 3


This practice session contains:
• Invoking Report Builder
• Opening an existing report
• Switching views in the Report editor
• Accessing the Help system

Introduction
The questions in the practice session provide an introduction to the Report Builder
interface. You open and navigate through an existing report definition and use the
Help system to obtain information about some of the Report executables.

......................................................................................................................................................
A-14 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 3
......................................................................................................................................................

Practice Session Solutions: Lesson 3


1 If you closed Project Builder in Practice 1, invoke Project Builder and
then invoke Report Builder from the Project Builder Launcher toolbar. If
it is still open, go to Report Builder.
If you need to reopen Report Builder, choose Project Builder from
the Oracle Developer menu. Do not open an existing project. Choose
Cancel.
In the Launcher choose Report Builder.
2 Open an run an existing report: p3q2.rdf.
In the Welcome dialog box of Report Builder select the Open an
Existing Report option and choose OK.
Open p3q2.rdf from the file system and run the report.
If prompted, connect to the database using the login information
your instructor gives to you.
When the parameter form comes up, choose Run Report, accepting
all the defaults.
3 In the Report editor, switch to the Data Model view.
In the Object Navigator, select Q_1.
Hint: Use the Find field at the top of the Object Navigator.
Notice the object that is selected in the Data Model view.
While the Report Editor window is active, choose View—>Data
Model from the menu.
Activate the Object Navigator window.
Click in the Find field and enter Q_. The Navigator expands the
appropriate node and highlights the first object that meets the
entered value.
In the Data Model editor, the query object Q_1 is selected.

......................................................................................................................................................
Oracle Developer: Build Reports A-15
Appendix A: Solutions
......................................................................................................................................................

4 In the Report editor, switch to the Layout Model.


In the Object Navigator, select F_ID.
Hint: Use the Find field at the top of the Object Navigator.
Notice the object that is selected in the Layout Model view.
Fully expand the Layout Model node and select R_G_ORD_ID.
Notice the object that is selected in the Layout Model view.
While the Report Editor window is active, choose View—>Layout
Model from the menu.
Activate the Object Navigator window.
Click in the Find field and enter F_. The Navigator expands the
appropriate node and highlights the first object that meets the
entered value.
In the Layout Model editor the field F_ID is selected.
In the Object Navigator window, select the Layout Model node and
choose Expand All in the toolbar; or choose
Navigator—>Layout Model editor. Choose Expand All from the
menu. Select R_G_ORD_ID.
In the Layout Model editor, the repeating frame R_G_ORD_ID is
selected.
5 In the Report editor, switch to the Parameter Form view.
In the Object Navigator, expand the Parameter Form node. Select
PF_DESTYPE. Notice the object that is selected in the Parameter Form.
Use the Find field at the top of the Object Navigator to select
P_CUSTID. Is any object selected in the Parameter Form? What is the
reason?
While the Report Editor window is active, choose View—>
Parameter Form from the menu.
In the Object Navigator select the Parameter Form node and choose
Expand All from the toolbar or choose Navigator—>Expand All
from the menu. Select PF_DESTYPE.
In the Parameter Form editor the object PF_DESTYPE is selected.
In the Object Navigator window, click in the Find field and enter P_.
The Navigator expands the appropriate node and highlights
P_CUSTID.
In the Parameter Form editor the object PF_DESTYPE is not
selected, because P_CUSTID is a parameter and not a parameter
field. Parameters are part of the Data Model, not the Parameter
Form.

......................................................................................................................................................
A-16 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 3
......................................................................................................................................................

6 Use Help Topics to answer the following questions:


From the menu, choose Help—>Report Builder Help Topics. In the
Index tab, enter Executables in the selection field; select Invoking
from the index entry list below and choose Display. Choose Related
Topics.
a What is RWMTS60?
Choose RWMTS60 from the dialog box.
b What is RWCLI60?
Choose RWCLI60 from the text.
c Close the Help system.

......................................................................................................................................................
Oracle Developer: Build Reports A-17
Appendix A: Solutions
......................................................................................................................................................

Practice Session Overview: Lesson 4


This practice session contains:
• Creating and saving a Tabular report
• Modifying the report to create and save a Group Above break report
• Creating and saving a form letter
• Creating and saving a Matrix report
• Creating and saving a Matrix with Group report

Introduction
The questions in the practice session are intended to ensure that you have a good
understanding of how to create various styles of report using the Report Wizard.
Note: When you are completing the practice sessions, keep to the file-naming
conventions that the questions specify. You might need these files in later practices.
In addition, note the field headings and widths. With many reports, you need to
change these to achieve the desired result.
Many of the practice sessions ask you to rename files beforehand; be sure to use
Save As, not Save, so that you do not overwrite the existing file name.

......................................................................................................................................................
A-18 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 4
......................................................................................................................................................

Practice Session Solutions: Lesson 4


Invoking Report Builder and the Wizard
If Report Builder is not open, launch it from Project Builder and create a
new report using the Report Wizard.
Select Project Builder from the Oracle Developer menu. Do not open an
existing project. Choose Cancel.
In the Launcher, choose Report Builder.
In the Welcome dialog box of Report Builder, select the Use the Report
Wizard option and choose OK.
If Report Builder is open after the previous practice session:
• Close any reports currently in the Object Navigator.
• Create a new report by selecting the Report node and choosing Create
Object.
Note: There is an alternative method. If no reports are open in the Object
Navigator, you can double-click the Report node.
1 Create a tabular report containing the following data. Use Query Builder
to build the query.
S_DEPT: NAME
S_EMP: FIRST_NAME, LAST_NAME, TITLE, SALARY, COMMISSION_PCT
Display all fields. Do not make any changes to the other wizard pages.
In the Select Data Tables dialog box, highlight the S_DEPT and
S_EMP tables, choose Include, and close the dialog box.
In the Query Builder window, select the columns from the tables and
choose OK.
Choose Next.
Copy all fields from the Available Fields area to the Displayed Fields
area.
Choose Next on all other wizard pages and choose Finish on the last
page.

......................................................................................................................................................
Oracle Developer: Build Reports A-19
Appendix A: Solutions
......................................................................................................................................................

2 Using the reentrant Report Wizard, make the following modifications


(test your report frequently).
Select Tools—>Report Wizard from the menu or choose Report
Wizard from the horizontal toolbar.
Modify the query to sort the data in descending order of salary.
On the Data tab choose Query Builder.
In the Query Builder window choose Sort. Copy the SALARY
column to the Sorted Columns, select it, and choose Sorting Order
Descending. Close the Sort dialog box and the Query Builder.
Choose Finish to test your report.
Add a summary to show the total salary value.
Reenter the Report wizard by choosing Report Wizard from the
toolbar.
On the Totals tab select SALARY and choose Sum.
Reduce the width of SALARY and TOTAL to 6.
Change the COMMISSION_PCT label to Comm and reduce the width
to 4.
Make the necessary changes on the Labels tab and choose Finish to
test your report.
Save the report to a file named p4q2.rdf.
Select File—>Save As from the menu and save the file to disk.
3 Using the reentrant wizard, modify the report to create a break report.
Choose report style Group Above.
Choose the report style on the Style tab.
Group the report by the department name.
On the Groups tab copy NAME to the Group Fields area.
Choose the template called Bright 1.
Choose the template on the Template tab. Choose Finish to close the
Wizard.
Save the report as p4q3.rdf.
Select File—>Save As from the menu and save the file to disk.

......................................................................................................................................................
A-20 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 4
......................................................................................................................................................

4 Create a new report containing the following data:


Use the Report Wizard.
Choose Mailing Labels style.
Use Query Builder to build the query.
Create a new report by selecting the Report node in the Object
Navigator and choosing Create Object.
As an alternative you can also select File—>New—>Report from the
menu.
Choose Mailing Label style. For the query type, accept the default
selection of SQL statement.
Choose Query Builder.
In the Select Data Tables highlight the S_CUSTOMER and S_ORD
tables, choose Include, and close the dialog box.
In the Query Builder window select the necessary columns from the
tables and choose OK.
S_CUSTOMER: NAME, ADDRESS, CITY, STATE
S_ORD: ID, DATE_SHIPPED, TOTAL
In the text area, include all four customer fields, each field on a new line.
Copy NAME, CITY, ADDRESS, and STATE to the Mailing Label
Text area. To enter the line feeds you can either use the button or
simply press the [Return] key.
Select the template Draft and choose Finish.
Select the template on the next page.
Save the report to a file named p4q4.rdf.
Select File—>Save As from the menu and save the file to disk.

......................................................................................................................................................
Oracle Developer: Build Reports A-21
Appendix A: Solutions
......................................................................................................................................................

5 Using the reentrant wizard, modify the report to create a Form Letter
style.
Reenter the Report wizard by choosing Report Wizard from the
toolbar or selecting Tools—>Report Wizard from the menu.
On the Style tab choose Form Letter.
In the text area, enter some free-flowing text for each order. For
example:
Order No. &<ID> was shipped to &<NAME> in &<CITY> on
&<DATE_SHIPPED>.
The order has a total value of &<TOTAL> dollars.
Copy the fields that you want to use to the Form Letter Text area
and enter your free-flowing text.
Select a different template and choose Finish.
Save the report as p4q5.rdf.
Select File—>Save As from the menu and save the file to disk.
6 Create a new report.Use Query Builder to build the query.
Create a new report by selecting the Report node in the Object
Navigator and choosing Create Object.
As an alternative you can also select File—>New—>Report from the
menu.
Choose the matrix report style.
On the first page choose Matrix.
For the query, import the contents of p4q6.sql.
Choose Import SQL Query and select p4q6.sql from the Import
dialog box.
Display customer names down the left side of the page.
Copy NAME to the Matrix Row Fields area.
Display product numbers across the top of the page.
Copy PRODUCT_ID to the Matrix Column Fields area.
Display the total value in the cells.
Choose Sum to copy the sum of TOTAL_VALUE to the Matrix Cell
Fields area.
Create a summary to give the total of the sum(total_value) values.
Select Sum(TOTAL_VALUE) and choose Sum.

......................................................................................................................................................
A-22 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 4
......................................................................................................................................................

Reduce the widths of PRODUCT_ID to 5 and all four summaries to 7.


Change the PRODUCT_ID label to Product.
Make the necessary changes in the Labels and Width fields.
Choose a template that gives Landscape output.
Select one of the Landscape templates and choose Finish to run your
report.
Save the report to a file named p4q6.rdf.
Select File—>Save As from the menu and save the file to disk.

If You Have Time


7 Modify the matrix report to create a Matrix with Group.
Reenter the Report wizard by choosing Report Wizard from the
toolbar or Tools—>Report Wizard from the menu.
On the Style tab choose Matrix with Group.
Choose Month as the group and check that all totals have a width of 7.
Go to the Group tab and copy MONTH to the Matrix Group Fields
area.
Check on the Labels tab that all fields with a label Total: have a
width of 7.
Save the report as p4q7.rdf.
Select File—>Save As from the menu and save the file to disk.
Note: The query for the matrix reports above has been restricted to display
only products beginning with “4,” so that you can see and understand the
complete matrix more easily.

......................................................................................................................................................
Oracle Developer: Build Reports A-23
Appendix A: Solutions
......................................................................................................................................................

Practice Session Overview: Lesson 5


This practice session involves modifying reports by applying changes in the Live
Previewer

Introduction
In this practice session you will reuse some of the reports that you created in
the last session.

......................................................................................................................................................
A-24 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 5
......................................................................................................................................................

Practice Session Solutions: Lesson 5


1 Open report p4q2.rdf. Make the following changes in the Live
Previewer:
To open the file select File—>Open from the menu or choose Open
on the toolbar.
Run the report by selecting it in the Object Navigator and then
selecting Program—> Run Report from the menu or choosing Run
in the toolbar.
a Make the columns SALARY and COMM right justified. Do not
forget to justify the column header accordingly.
Select the columns SALARY and COMM and their labels. Then
choose End Justify from the style bar or select Format—>
Justify—>End from the menu.
b Add commas and a currency symbol to SALARY. Add two decimal
places.
While the column is selected choose Commas from the style bar.
This adds the group separators. Then choose Add Decimal Place
from the style bar to add one decimal place. Repeat the action
for the second decimal place. You can also select the commas and
decimal places options from the Format menu.
c Add one decimal place and a percent sign to COMM.
While the column is selected choose Percent and then Add
Decimal Place from the style bar. You can also select the percent
and decimal places options from the Format menu.
d Edit the heading of the COMM field. Change the text to Comm Pct.
Select the label of the COMM field, then click it again to get into
Change mode. Enter your text, then click outside the label to
make your changes permanent.

......................................................................................................................................................
Oracle Developer: Build Reports A-25
Appendix A: Solutions
......................................................................................................................................................

eMake the total at the end of the report right justified and add
commas, currency symbol, and two decimal places, as in the column
SALARY.
Select the column, then choose End Justify from the style bar or
select Format—>Justify—>End from the menu.
While the column is selected choose Commas and then Add
Decimal Place from the style bar. Repeat the action for the
second decimal place.
f Change the label of the total to bold font.
Select the label, then choose Bold from the style bar or use
Format—>Font in the menu.
g Make whatever other changes you like.
No formal solution.
h Save the report to a file named p5q1.rdf and close it.
2 Open report p4q3.rdf. Make the following changes in the Live
Previewer:
To open the file select File—>Open from the menu or choose Open
from the toolbar.
Run the report by selecting it in the Object Navigator and then
selecting Program—> Run Report from the menu or choosing Run
from the toolbar.
a Remove the border around the total for each department.
Select the column, and choose Line Color from the vertical
toolbar. Choose No Line to remove the line color.
b Add commas and two decimal places to the SALARY field and the
total and make them right justified. Do not forget to justify the
column header for the SALARY field accordingly.
Select the column and its header, then choose End Justify from
the style bar or select Format—>Justify—>End from the menu.
While the column is selected choose Commas and then Add
Decimal Place from the style bar. Repeat the action for the
second decimal place. You can also select the options from the
Format menu.

......................................................................................................................................................
A-26 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 5
......................................................................................................................................................

cMake the same changes to the total at the end of the report. Move the
grand total so that it aligns with the SALARY field (you must do this
manually; use the ruler guides to help you).
Select the column, then choose End Justify from the style bar or
select Format—>Justify—>End from the menu.
While the column is selected choose Commas and then Add
Decimal Place from the style bar. Repeat the action for the
second decimal place. You can also select the options from the
Format menu.
d Change the color of the heading to gray.
Select a label, and choose Select Parent Frame from the style bar.
Choose Fill Color from the vertical toolbar.
e Make whatever other changes you like.
No formal solution.
f Save the report to a file named p5q2.rdf and close it.
3 Open report p5q3_a.rdf. Make the following changes in the Live
Previewer:
To open the file select File—>Open from the menu or choose Open
from the toolbar.
Run the report by selecting it in the Object Navigator and then
selecting Program—> Run Report from the menu or choosing Run
from the toolbar.
a Add a date at the top center of the page. Give it any format you want.
Hint: Choose the font, style, and text color you want before inserting
the date.
Choose Insert Date and Time from the top toolbar or
Insert—>Date and Time from the menu.
b Make whatever other changes you like.
No formal solution.
c Save the report to a file named p5q3.rdf and close it.

......................................................................................................................................................
Oracle Developer: Build Reports A-27
Appendix A: Solutions
......................................................................................................................................................

4 Open report p4q6.rdf. Make the following changes in the Live


Previewer:
To open the file select File—>Open from the menu or choose Open
from the toolbar.
Run the report by selecting it in the Object Navigator and then
selecting Program—> Run Report from the menu or choosing Run
from the toolbar.
a Right justify the Product ID field.
Select the Product ID field, then choose End Justify from the
style bar or choose Format—>Justify—>End from the menu.
b Remove the border around the cell values and the parent frame.
Select the column, hold down the [Shift] key, and choose Select
Parent Frame from the style bar.Then hold down the [Shift] key
and select the column again. Choose Line Color from the vertical
toolbar. Choose No Line to remove the line color from both the
column and the parent frame.
c Add commas and two decimal places to the cells and summaries and
make them right justified.
Select the columns and choose End Justify from the style bar or
select Format—>Justify—>End from the menu.
While the columns are selected choose Commas and then Add
Decimal Place from the style bar. You can also select the options
from the Format menu.
d Add a gray line color to the parent frames of NAME and PRODUCT
ID.
Select the column NAME and choose Select Parent Frame from
the style bar. Choose Line Color from the vertical toolbar.
Repeat for the column PRODUCT.
e Save the report to a file named p5q4.rdf and close it.

......................................................................................................................................................
A-28 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 5
......................................................................................................................................................

If You Have Time


5 Open the file p5q2.rdf and conditionally highlight the SALARY field.
To open the file select File—>Open from the menu or choose Open
from the toolbar.
Run the report by selecting it in the Object Navigator and then
selecting Program—> Run Report from the menu or choosing Run
from the toolbar.
a If the salary is less than 1000, then print the field in italics.
Select the SALARY field, then choose Format—>Conditional
Formatting from the menu or use the right mouse button to open
the pop-up menu and choose Conditional Formatting from the
pop-up menu.
The Conditional Formatting dialog box opens. Choose New and
enter the condition and formatting as required. Choose OK to
return to the first page but do not close the dialog box.
b If the salary is more than 2000, then print the field in italics and
make the text color red.
Choose New again and enter the second condition and
formatting as required. Choose OK to return to the first page of
the dialog box and then OK again to close the dialog box.
6 Save the report to a file named p5q5.rdf and close it.

......................................................................................................................................................
Oracle Developer: Build Reports A-29
Appendix A: Solutions
......................................................................................................................................................

Practice Session Overview: Lesson 6


This practice session contains:
• Customizing an existing template
• Applying the modified template to an existing report

Introduction
In this practice session, you open an existing template, which is one of the standard
templates shipped with the Oracle Developer Release 6 installation.
You modify objects in the margin and body regions and save the template to a new
filename. Then you apply the modified template to an existing report and note the
differences.

......................................................................................................................................................
A-30 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 6
......................................................................................................................................................

Practice Session Solutions: Lesson 6


1 Customize an existing template, adding a company logo and report title
to the report margin, and modify the report body.
a Open corp1.tdf. This file should exist in your home directory; it is
a copy of the Corporate 1 predefined template.
Select the Templates node in the Object Navigator.
Choose Open and select the file named corp1.tdf.
b Display the margin region. (This usually appears by default when
you open a template.)
c Delete the Oracle buildings logo. Import summitlo.tif and place in
the top left corner of the margin; this file should exist in your home
directory.
Select the Oracle buildings logo and press the [Delete] key.
Choose File—>Import—>Image from the menu.
From the File Browse window choose the file name
summitlo.tif.
Resize it to fit into the margin region.
d Modify the report title line: change 21st Century Products to Summit
Report.
Choose the Text tool from the vertical toolbar.
Select the text 21st Century Products and change it to Summit
Report.
e Display the body region to view the changes you will make in the
next steps.
Choose the Margin/Body toggle button from the toolbar in the
Template editor.
f Change the foreground color (fill color) of the section frame to
white. Make these changes general, not specific to a particular
layout.
In the Template editor select the Section Frame. Select any of the
objects and use the Select Parent Frame tool to select the
outermost frame.
Use the Fill Color palette or the property palette to change the
color.
Alternative solution:
In the Object Navigator expand the Body node, the Default node,
and the Frames node. Open the property palette for the body of
the section frame.

......................................................................................................................................................
Oracle Developer: Build Reports A-31
Appendix A: Solutions
......................................................................................................................................................

Under the heading Style, change the Foreground Color property


to White.
g Change the justification of number fields to End. Do not forget to
change the justification of labels for number fields to End.
Select the number field and the number heading in the Template
editor and choose the End justify tool from the stylebar.
Alterative solution:
Open the Field Labels/Headings and the Fields nodes in the
Object Navigator. Select Number in both nodes.
Open the property palette for your selections.
Choose Union (the button is a toggle and the tooltip says
Intersection at this point) from the property palette toolbar to
display all properties. Under the headings Label and Fields,
change the number justification to End.
Change the justification of number summary fields to End.
Select Summaries in the Object Navigator.
In the property palette change the number justifications for
fields to Right.
h Save the template as summit.tdf.
2 Apply the modified template to an existing report.
Hint: you must search for the template file; it does not appear in the list of
predefined templates.
a Open p4q3.rdf.
b Apply summit.tdf to the report.
Invoke the Report Wizard. On the Template tab select the option
Template File. Choose Browse to enter the name of the file in the
field below.
c The report shows some changes but not all. Which template changes
have been applied and which have not?
Changes applied: Logo, report title, color of section frame region
Changes not applied: Number justification
d To apply all changes to your report you will have to create the layout
again. From the menu choose Edit—>Select All to select all layout
objects. Now delete them. Invoke the Report Wizard and reapply
your template.
e Save the report as p6q2.rdf.

......................................................................................................................................................
A-32 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 6
......................................................................................................................................................

3 Continue to modify the template and test it using a new report.


a Change the text color of the master group fields to red for the Group
Left style only.
Hint: In the Template editor, use the Report Style list to switch to a
Group Left style. This way you can select the correct group. You
may also want to use the Zoom Out tool, so that you can see the
entire template layout structure, and recognize the difference
between the master group fields and the detail group fields.
Select the Character, Number, and Date fields and change the
text color with the Text color palette.
Alternative solution:
In the Object Navigator, expand the Override node, then the
Group Left, the Section (Level1), and the Fields nodes.
Bring up the property palette for all the fields
Change the text color to red.
b Save your template as summit2.tdf and close it.
c Create a new report, using the Report Wizard.
Use the layout style Group Left.
Import the query p6q3.sql from your working directory.
Make NAME the group field.
Display all other columns.
Do not create summaries.
Change the width of SALARY to 6 and COMM to 4.
Apply the Template file summit2.tdf.
No formal solution.
d Save the report as p6q3.rdf and close it.

......................................................................................................................................................
Oracle Developer: Build Reports A-33
Appendix A: Solutions
......................................................................................................................................................

Practice Session Overview: Lesson 7


This practice session contains:
• Using the Help system to find comprehensive information on storage types and
executables
• Converting the storage type of a report using the Convert utility
• Documenting a report using the Report on Reports utility
Because the Report Builder tables are optional in Oracle Developer, your
classroom might not have the tables available for you to save your report. Your
instructor will advise you whether to attempt this question.

......................................................................................................................................................
A-34 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 7
......................................................................................................................................................

Practice Session Solutions: Lesson 7


1 Search in the Help system for information on the RWCON60 executable.
From the menu, choose Help—>Report Builder Help Topics. Enter
RWCON60 in the Find tab.
What is this executable used for?
RWCON60 enables you to convert one or more report definitions or
PL/SQL libraries from one storage format to another.
Can you compile more than one report with this utility?
Yes
What other tool could you use to compile several reports?
Hint: You may want to refer to Lesson 1.
Project Builder
When converting a report to a template, what is converted and what is
not?
Only objects in the header and trailer pages and in the margin area
are used in the template. Objects in the body are ignored.
2 Use the Convert utility in Report Builder to convert a report from .rdf
to .rep.
a Open p6q3.rdf , if it is not already open.
b Convert it to a .rep file.
Choose File—>Administration—>Convert from the menu.
Document Type: Report
Source Type: Report Binary File (RDF)
Source: Enter the filename, including the path, or choose
Browse.
Destination Type: Report Binary Run-only File (REP)
Leave Destination empty.
c What other methods could you use to compile a report?
File—>Administration—>Compile report or Ctrl T
What is the difference?
The Compile option from the menu compiles the presently
selected report; the Convert utility enables you to choose which
report or reports to compile. It also enables you to convert to
other storage types.

......................................................................................................................................................
Oracle Developer: Build Reports A-35
Appendix A: Solutions
......................................................................................................................................................

d Convert the same report to a .rex file.


Choose File—>Administration—>Convert from the menu.
Document Type: Report
Source Type: Report Binary File (RDF)
Source: Enter the filename, including the path, or choose
Browse.
Destination Type: Report ASCII File (REX)
Leave Destination empty.
e Open a system editor to look at the .rex file.
No formal solution.

If You Have Time


3 If the database product tables are installed, document a report definition
that is saved in the database.
a Save report p6q3 to the database.
Either change your preferences to be able to save to the database
(Tools—>Preferences—>Object tab)
or use the convert utility (File—>Administration—>Convert).
b Run the Report on Reports utility to produce documentation on the
report p6q3. Set the run-time parameters to output to a file in PDF
format.
Choose File—>Administration—>Report on Reports.
Select report name P6Q3.
Destination Type: File
Destination Name: p6q3.pdf
Destination Format: PDF
c Open the PDF file and scroll through the documentation.

......................................................................................................................................................
A-36 Oracle Developer: Build Reports
Practice Session Overview: Lesson 8
......................................................................................................................................................

Practice Session Overview: Lesson 8


This practice session contains:
• Creating a second query in an existing report
• Restricting records in a query
• Restricting records with a packaged filter
• Creating a data link
• Creating a report containing a master group with two detail groups
• Creating an external query file and referencing the file in a new report

Introduction
In this practice session you include new data in a report by adding a query to
an existing single-query report created with the wizard. You also practice
linking data from different queries to alter the report structure. Using two
different techniques, you restrict the records in a report. If you have time,
you create a external query and link it to a report.

......................................................................................................................................................
Oracle Developer: Build Reports A-37
Appendix A: Solutions
......................................................................................................................................................

Practice Session Solutions: Lesson 8


1 Open report p8q1_a.rdf, which contains a single-query report showing
customer information.
a In the Data Model create a new query. Either use the Query Builder
or import filename p8q1.sql. Change the group_name to G_ORD.
QUERY: Q_ORD:
SELECT customer_id, id, date_shipped, total
FROM s_ord
bOpen the Report Wizard and choose a Tabular layout.
c Copy group G_ORD to the Displayed Groups area.
d Copy all remaining fields to the Displayed Fields area.
e Choose Finish.
f Note how the data appears in the Live Previewer. The
Q_CUSTOMER data appears before the Q_ORD data. Remember
that you can alter the order in which the data is printed by modifying
query order in the Data Model. You may want to try that.
Note: If you do adjust the order of the queries, put them back in the
original order and save before the next question.
g Save the report as p8q1.rdf. Do not close the report.
2 Modify the previous report to restrict the number of customer records
processed by the group.
a Place a filter on the G_CUSTOMER group to display only the first
four customers. Run to test.
Select the group G_CUSTOMER in the Data Model and open
the property palette. Set the property Filter Type to First and
enter the number of records.
b Save the report as p8q2.rdf and close it.
c Close the report and any others you still have open in the Object
Navigator.

......................................................................................................................................................
A-38 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 8
......................................................................................................................................................

3 Open p8q1.rdf .
In the Data Model link the two queries together on the primary and
a
foreign keys.
Hint: To create the link, select the Link tool. Click and drag from the
Primary Key field in the Customer group to the Foreign Key field in
the Ord group.
b Redo the layout by opening the Report Wizard. Choose Group
Above style. Do not display CUSTOMER_ID.
c Run to test.
d Save the report as p8q3.rdf.
4 Modify p8q3.rdf to show and restrict customers’ credit rating. You
need to modify the query properties.
a Include CREDIT_RATING in the query statement, although you do
not need to display it. Restrict the query statement to show those who
have a poor credit rating.
In the Data Model select the query Q_CUSTOMER. Press the
right mouse button to open the SQL Query Statement or open it
from the property palette.
Either enter WHERE S_CUSTOMER.CREDIT_RATING =
’POOR’ directly in the query statement area or use the Query
Builder to build the WHERE clause.
If you use the Query Builder, click in the blank condition field
Conditions panel to activate it. Then click the column
CREDIT_RATING in the S_CUSTOMER table. Enter =
’POOR’ and press Return.
b Run to test.
c Save the report as p8q4.rdf and close it.

......................................................................................................................................................
Oracle Developer: Build Reports A-39
Appendix A: Solutions
......................................................................................................................................................

5 Create a new report that lists the sales representatives and the products
they have sold.
a Choose a Group Above report style.
b Import the query file p8q5_a.sql.
c Make NAME and ID the group fields. Make sure that these fields are
in one group, at Level 1, not two separate groups.
d Do not display ID, but display all other fields in the order described
in the following table.
Hint: You can change the order of fields in the Report Wizard from
the Fields tab.
e Change the following field attributes:

Column Label Width


NAME Name 20
PRODUCT Product 10
PRODUCT_ID ID 4
QUANTITY Quantity 4
PROD_TOTAL Total 6

f Use the template file summit.tdf


g Run and test your report.
h Now you need to show not only which products the sales
representatives have sold but also who are the customers they have
done business with.
Go to the Data Model and add a new query, importing the file
p8q5_b.sql. This query returns the customer names, their IDs, and
the total sales per customer for each sales representative.
i Rename the group G_CUSTOMER.
j Link the second query to the correct group.
Click and drag from ID in G_NAME to SALES_REP_ID in
G_CUSTOMER.
k Use the Report Wizard to display the new group. Do not display
SALES_REP_ID or ID.

......................................................................................................................................................
A-40 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 8
......................................................................................................................................................

l Change the following field attributes:

Column Label Width


CUSTOMER Customer 10
CUSTOMER_ID ID 4
CUST_TOTAL Total 6

m Run and test your report.


n Save the report as p8q5.rdf and close it.

If You Have Time


6 Create an External Query module that selects the following data:
Select the External SQL Queries node in the Object Navigator and
choose Create.

Columns Table
id, name s_dept
id, first_name||’ ’||last_name, title, salary s_emp
a Remember to include a join condition.
b Give the columns meaningful names.
Write the following query:
SELECT S_DEPT.ID DEPT_ID
, S_DEPT.NAME DEPARTMENT
, S_EMP.ID EMP_ID
, S_EMP.FIRST_NAME ||’ ’|| S_EMP.LAST_NAME EMPLOYEE
, S_EMP.TITLE
, S_EMP.SALARY
FROM S_DEPT, S_EMP
WHERE S_EMP.DEPT_ID=S_DEPT.ID

c Save the query as p8q6.sql and close the query window.

......................................................................................................................................................
Oracle Developer: Build Reports A-41
Appendix A: Solutions
......................................................................................................................................................

7 Use the Report Wizard to create a Group Left report using the external
query created in question 6.
a Department information should be in the master group.
b Look at the Data Model. Notice that the break group exists.
c In the Data Model, move TITLE into a group at the top of the
hierarchy.
Hint: Move it into the Department group first, then up into its own
new group.
Click and drag TITLE to the Department group, then up again
to make a separate group. Rename the group G_TITLE.
Note: Because this is a single-query report, you can also make the group
change using the Report Wizard Group tab. However, you have learned
that you can combine many queries and groups in your own reports, and
this simple exercise helps you to practice moving columns in the data
model.
d Open the Report Wizard and choose Finish to update the layout and
run the report.
e Run and test the report.
f Save the report as p8q7.rdf and close it.
8 Create a new report, using a ref cursor query.
a In the Object navigator, create a package defining a record and a ref
cursor. The record has the following fields:
Name Definition
last_name s_emp.last_name%type
first_name s_emp.first_name%type
salary s_emp.salary%type

Select the Program Units node in the Object Navigator and


choose Create.
In the New Program Unit dialog box enter a name for the
package and choose Package Spec.
Enter the code for the package specification.

......................................................................................................................................................
A-42 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 8
......................................................................................................................................................

PACKAGE RefCur IS
TYPE EmpRec IS RECORD ( last_name s_emp.last_name%TYPE,
first_name s_emp.first_name%TYPE,
salary s_emp.salary%TYPE);
Type EmpCur IS REF CURSOR RETURN EmpRec;
END;
Note: You can import the file p8q8a.txt.
You can also import the text file p8q8a.txt. While the PL/SQL editor is
active and the cursor is in the text area, choose File—>Import Text from
the menu to import the text file.
b In the Data Model create a Ref Cursor Query. The function opens the
cursor for the following select statement:
SELECT last_name, first_name, salary
FROM s_emp
Note: You can import the file p8q8b.txt.
Write the following function or import the text file p8q8b.txt:
FUNCTION QR_1RefCurDS RETURN RefCur.EmpCur IS
V_EmpCur RefCur.EmpCur;
BEGIN
OPEN V_EmpCur
FOR
SELECT last_name, first_name, salary
FROM s_emp;
RETURN V_EmpCur;
END;
Open the Report Wizard to create the layout for the report. Select all
c
the fields and choose a template.
d Run and test the report.
e Save the report as p8q8.rdf and close it.
Do you still have any objects open in the Object Navigator? If you do, close them all.

......................................................................................................................................................
Oracle Developer: Build Reports A-43
Appendix A: Solutions
......................................................................................................................................................

Practice Session Overview: Lesson 9


This practice session contains:
• Creating a new report with summaries
• Opening an existing report to add summary calculations to the columns
• Creating a report that displays the contents of a file in a column
• Creating a new report with ranking summary columns
(Use an ORDER BY clause to create the ranking effect.)
• Opening an existing report to add placeholders for the highest and
lowest values in the report

Introduction
In your reports, you may need to include additional columns with summary
functions—or even add summaries, such as break totals and report totals.
This practice gives you the opportunity to create summaries and additional
columns with functionality that cannot be achieved using SQL alone.

......................................................................................................................................................
A-44 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 9
......................................................................................................................................................

Practice Session Solutions: Lesson 9


1 Create a new report using the Report Wizard. Choose a Group Above
report style.
a Display the following data:

Table Column Definition Group Label Width


s_ord id G_ord Ord. No. 4
date_ordered Order Date 9
s_item item_id G_item No. 2
product_id Product No. 5
price Price 4
quantity_shipped Quantity 4
line_total price*quantity_shipped Total 4

b Do you need a formula column to calculate the line_total?


No, it is a much better solution to do the calculation directly in
the query.
Enter the formula price*quantity_shipped into the query text
and give it an alias name of line_total.
You can also use the Query Builder to create expressions in the
query.
Select the table S_ITEM.
Choose Define Column.
Click inside the Defined Columns box.
Enter Line_Total.
Click inside the Defined As box.
Enter the expression price*quantity_shipped.
Choose OK.

......................................................................................................................................................
Oracle Developer: Build Reports A-45
Appendix A: Solutions
......................................................................................................................................................

c Create the following summaries. Can you use the Report Wizard to
create the summaries?
Because this is a single query report you can use the Report
Wizard.

Column Summary
line_total sum
line_total % Total

Use the summit.tdf template file from the file system.


d
In the Template tab choose and apply the template. Finish and
run the report.
e In the Data Model, rename the groups to G_ORD for the break group
and G_ITEM for the detail group. Alter the position of columns in
the G_ORD group so that DATE_ORDERED is above ID, and
change the break order on DATE_ORDERED so that it is sorted in
descending order.
Open the property palettes for each group and change the
names.
Click on DATE_ORDERED and drag it above ID; be careful not
to drag it outside the group.
Open the property palette for DATE_ORDERED and change
the Break Order property to Descending.
f Run and test the report (do not reenter the wizard).
g Save the report as p9q1.rdf and close it.
2 Open report p8q5.rdf.
a Add a summary to total PROD_TOTAL for each employee master.
Can you use the Report Wizard?
Because this is a multiquery report, you have to create all
summaries manually unless you created them with the first
query.
Select Summary Column in the vertical toolbar and click inside
the group G_NAME. This creates a new summary.
Open the property palette for the new column and name it
REP_TOTAL.
In the Summary section select the function Sum.
The Source is PROD_TOTAL.
Reset at G_NAME.

......................................................................................................................................................
A-46 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 9
......................................................................................................................................................

Create columns to show the percentage of the total per sales


b
representative for PROD_TOTAL and CUST_TOTAL.
Select Summary Column in the vertical toolbar and click inside
the group G_PRODUCT. This creates a new summary.
Open the property palette for the new column and name it
PCT_PROD.
In the Summary section select the function % of Total.
The Source is PROD_TOTAL.
Reset at G_PRODUCT.
Compute at G_NAME.
Select Summary Column in the vertical toolbar and click inside
the group G_CUSTOMER. This creates a new summary.
Open the property palette for the new column and name it
PCT_CUST.
In the Summary section select the function % of Total.
The Source is CUST_TOTAL.
Reset at G_CUSTOMER.
Compute at G_NAME.
c Make all the new summaries four characters wide.
d Run and test the report.
e Save the report as p9q2.rdf and close it.
3 Create a new report using the Report Wizard.
a Choose a Tabular report style and display the following information:

Table Column Label


s_product id Id
name Name
short_desc Description
s_image filename picture

......................................................................................................................................................
Oracle Developer: Build Reports A-47
Appendix A: Solutions
......................................................................................................................................................

Restrict the query to return only products with ID beginning with 10


b
or 30 because you do not have picture files for all products.
Enter the following:
WHERE S_PRODUCT.ID LIKE ’10%’
OR S_PRODUCT.ID LIKE ’30%’
into the query.
You can also use the Query Builder to create complex WHERE
clauses.
Click in the condition fields in the Conditions panel. Then select
the column ID from the S_PRODUCT table. This copies the
name of the column into the condition field.
Enter LIKE ’10%’ into the condition field and press Return.
Enter S_PRODUCT.ID LIKE ’30%’ and press Return.
You will see AND in the box to the left.
To put an OR between the two conditions select AND, then
choose Or from the toolbar.
c Run the report.
d In the Data Model change the properties for the column “filename”
to read from file, file format image.
e Use the Report Wizard to redo the layout.
f In the Live Previewer resize the picture column to about 3x3 inches.
Hint: You need to enable Flex Mode. Use the last image on the page
to resize the picture column
g Save the report as p9q3.rdf and close it.
4 Open report p9q1.rdf to list the orders ranked by their total.
a In the Data Model add a new column s_ord.total to the query.
Hint: You will have to move the new column TOTAL to the G_ORD
group.
Any new column is added in the lowest group, so you must move
it up to G_ORD.
b Because you want to list the highest total first, set the break order for
TOTAL accordingly, and move the TOTAL column so that it is first
in the G_ORD group.
Set the break order for TOTAL to Descending. Click and drag
TOTAL to be the first column in the group G_ORD.

......................................................................................................................................................
A-48 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 9
......................................................................................................................................................

c To display the ranking add another column called RANK in the


group G_ORD.
Create a summary column in the group G_ORD.
Name it Rank. Select the function Count.
The Source is ID.
Reset at Report.
d Use the Report Wizard to display the rank, giving it a width of 2. You
do not need to display the total, because there is already a total on the
G_ITEM group.
e Run the report to test.
f Save the report as p9q4.rdf and close it

If You Have Time


5 Open report p9q1.rdf to display the highest and lowest orders at the end
of the report.
a In the Data Model add the columns necessary to list the maximum
order total and the corresponding ID as well as the minimum order
total and the corresponding ID.
Hint: You need one formula column and some summaries and
placeholders.
You can import the code for the formula column from the file
p9q5.txt.
At report level create two summary columns:

Name Function Source Reset At


CS_Max Maximum SumLine_totalPerID Report
CS_Min Minimum SumLine_totalPerID Report

......................................................................................................................................................
Oracle Developer: Build Reports A-49
Appendix A: Solutions
......................................................................................................................................................

a (continued)
Also at report level create two placeholder columns. Name them
CP_Maxid and CP_Minid. This is where the IDs of the highest
and lowest orders will go.
Create a formula column in the upper group and name it
CF_GetIds.
Return number 1 (although it does not really matter what you
return if the formula column is a character type).
The PL/SQL formula is the following:
function CF_GetIdsFormula return Number is
begin
if :SumLine_TotalPerId = :CS_Max then
:CP_Maxid := :ID;
end if;
if :SumLine_TotalPerId = :CS_Min then
:CP_Minid := :Id;
end if;
return (1);
end;

b Use the Report Wizard to put the new columns into the layout.
Display the maximum order total, the maximum ID, the minimum
order total, and the minimum ID.
Display columns CS_Max, CS_Min, CP_Maxid, and CP_Minid.
Give them more meaningful labels.
c Run the report to test. Scroll down to the last page to see the new
columns.
d Save the report as p9q5.rdf and close it.

......................................................................................................................................................
A-50 Oracle Developer: Build Reports
Practice Session Overview: Lesson 10
......................................................................................................................................................

Practice Session Overview: Lesson 10


This practice session contains:
• Opening an existing report to add header and trailer pages
• Modifying an existing report to add a button to display a multimedia
column
• Modifying an existing report to add a repeating frame to the header
section displaying order information.
• Opening an existing report and adding flexible lines
• Modifying an existing report to anchor a boilerplate object to an outer
frame

Introduction
In this practice session, you use reports created in earlier practice sessions.
The aim is to familiarize you with the different layout regions of a report.
You also add flexible lines to a frame and anchor one object to another.

......................................................................................................................................................
Oracle Developer: Build Reports A-51
Appendix A: Solutions
......................................................................................................................................................

Practice Session Solutions: Lesson 10


1 Open report p9q4.rdf. Modify the report as follows:
a Create a header section.
Open the Layout Model editor. Choose Header Section from the
horizontal toolbar or choose Layout Section—>Header Section
from the menu. Make sure that you are editing the Body region.
Display the summitlo.tif file as fixed boilerplate in the Body
region.
Choose File—>Import—>Image from the menu to import the
file. Move and resize it.
Add a rectangle boilerplate object. Give it fill color.
Choose the Rectangle tool from the vertical toolbar. Make the
rectangle large enough to fit the logo inside.
Choose Fill Color from the vertical toolbar.
Place the logo on top of the rectangle. Center the two objects.
Select the rectangle and choose Arrange—>Send To Back from
the menu.
Select the logo, press the [Shift] key, and select the rectangle.
Choose Arrange—>Align Objects from the menu. In the dialog
box select Align to Each Other and then Align Center both
horizontally and vertically. Choose OK.
Hint: Use the Arrange option from the menu.
b Add a report title in the body region.
Use font Arial, size 18 bold.
Choose the Text tool from the vertical toolbar and click in the
layout area. Enter the text and click outside the text object.
While the text object is selected, choose font and size from the
stylebar.

......................................................................................................................................................
A-52 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 10
......................................................................................................................................................

Add a trailer section that displays today’s date with the text “End of
c
report run on: ” in the body region. Choose a larger font.
Hint: Copy and paste the date from the Margin Area of the report.
Choose Trailer Section from the horizontal toolbar, or choose
Layout Section—>Trailer Section from the menu. Make sure
that you are editing the Body region.
Choose the text tool from the vertical toolbar and click in the
layout area. Enter the text and click outside the text object.
While the text object is selected, choose font and size from the
stylebar.
Choose Margin from the horizontal toolbar, or choose Layout
Section—>Margin View from the menu.
Select the f_date1 field and then choose Edit—>Copy from the
menu.
Choose Trailer from the horizontal toolbar, or choose Layout
Section—>Trailer View from the menu.
Choose Edit—>Paste from the menu and move the field to the
desired place.
d Run and test the report.
e Save the report as p10q1.rdf and close it.
2 Open report p9q3.rdf and modify it to display the product picture in a
separate window.
a Delete field F_FILENAME from the body region of the main section
in the Layout Model (not the column from the Data Model).
Open the Layout Model editor. Choose Body from the horizontal
toolbar or choose Layout Section—>Body View from the menu.
Select the f_filename field and press [Delete].

......................................................................................................................................................
Oracle Developer: Build Reports A-53
Appendix A: Solutions
......................................................................................................................................................

b Add a button to display the picture from the multimedia column.


Give it a meaningful label. In the Object Navigator, change the name
to PICTURE_BUTTON
Choose the button tool from the vertical toolbar and create a
button in place of the f_filename field.
Make the following changes in the property palette:

Property Value
Label Type Text
Text Picture
Type Multimedia Column
Multimedia Column Filename

c Resize the other layout fields to 1/4 inch in height.


Hint: Use the Arrange option on the menu.
Select all the layout fields by shift-clicking them.
Choose Arrange—>Size Objects from the menu.
Select Custom for height and enter .25.
d Make the button the same size.
Hint: Use the Arrange option on the menu.
e Give all fields and the button the same vertical alignment.
Hint: Use the Arrange option on the menu.
Align the fields and the button using Arrange—>Align Objects
from the menu.
f Resize the repeating frame and all enclosing frames to be just large
enough to fit the fields inside.
Hint: Think of Flex Mode.
Enable Flex Mode and resize the repeating frame.
g Save the report as p10q2.rdf and close it.
h Run and test your report. Do not use the Live Previewer; use Reports
Runtime.
i Choose File—>Administration—>Convert to convert the .rdf
file into a .rep file. Now invoke the Reports Runtime and test
your report.

......................................................................................................................................................
A-54 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 10
......................................................................................................................................................

3 Open report p9q1.rdf.


Modify the report to list all orders and order dates contained in the
a
report in the Body region of the Header section.
Open the Layout Model editor. Choose Header Section from the
horizontal toolbar, or choose View —>Layout Section—>Header
Section from the menu. Make sure that you are editing the Body
region.
Choose the Additional Default layout tool from the vertical
toolbar and click in the Layout area. In the Report Wizard
choose a tabular layout.
Select the group G_ORD and give a print direction down.
Select the fields ID and DATE_ORDERED.
b Save the report as p10q3.rdf and close it.
4 Open report p5q3.rdf.
a Use the Report Wizard to give last_name and first_name a width of
6 (you can also do it directly in the Layout Model or from the Live
Previewer).
b Add flexible lines vertically between the fields.
Choose the line tool from the vertical toolbar. Create lines
between the fields. If you want to ensure that the lines are
vertical, press the [Shift] key while drawing. Make the lines the
same height as the fields using the Arrange—>Size Objects
menu option.
In the property palette, set Line Stretch with Frame to
R_G_LAST_NAME.
c Run and test the report.
d Save the report as p10q4.rdf.

......................................................................................................................................................
Oracle Developer: Build Reports A-55
Appendix A: Solutions
......................................................................................................................................................

If You Have Time


5 Continue with report p10q4.rdf.
a Add boilerplate and anchor it to halfway down the right side of the
Report Group frame.
Hint: To ensure that you get the right frame, select the frame
M_G_LAST_NAME_GRPFR. You can use either the Object
Navigator or the Select Parent Frame tool. Pull the frame out slightly
to the right. After you have fastened your anchor, you can make it
smaller again.
Choose the Text tool from the vertical toolbar and click to the
right of the layout objects. Enter the text and click outside the
text object.
Give it a line color. This makes it easier to click on the edge.
Click on a field and choose Select Parent Frame from the style
bar twice to select the group frame. Drag the right edge a little to
the right to make the frame larger.
Select the Anchor tool from the vertical toolbar and click the left
edge of the boilerplate text object. Then click the right edge of
the group frame. You can press the [Shift] key while you create
the anchor to anchor it at 50% of the edges or you can make the
adjustments later in the property palette of the anchor.
Move the boilerplate so that the anchor is a straight horizontal
line.
Resize the group frame to its original size.
b Run and check that the text is in fact halfway down the data output.
c Rerun the report, this time displaying only 10 rows. The boilerplate
should still be halfway down the data output.
Create a group filter in the Data Model editor to restrict the
number of records.
d Save the report as p10q5.rdf and close it.

......................................................................................................................................................
A-56 Oracle Developer: Build Reports
Practice Session Overview: Lesson 11
......................................................................................................................................................

Practice Session Overview: Lesson 11


This practice session contains:
• Modifying the printing of a mailing label report
• Controlling the number of records on a page
• Adding a link file to a report
• Ensuring that all details of a master print on the same page

Introduction
Modify a mailing label report to ensure that you fill the printed page with
label records. You then restrict the number of labels that are printed on each
page.
You add a link file to display a company logo by dynamically referencing a
file at run time.

......................................................................................................................................................
Oracle Developer: Build Reports A-57
Appendix A: Solutions
......................................................................................................................................................

Practice Session Solutions: Lesson 11


1 Open report p4q4.rdf.
a Modify the layout so that the mailing labels are 2 inches wide and 1
inch high. Use the Arrange option on the menu. Ensure that the
company names are printed in alphabetical order across the page.
Open the Layout Model editor. Select the repeating frame: either
select the boilerplate object in the Layout Model editor and then
choose Select Parent Frame from the style bar,
or select the repeating frame in the Object Navigator.
While the Layout Model editor is the active window, choose
Arrange—>Size Objects from the menu. Select Custom for both
width and height and enter the width and height in the fields
below.
You can also drag the repeating frame in the Layout Model
editor to the desired width and height.
Add an ORDER BY clause to the query.
b Give each label a solid fill.
Choose Fill Color from the vertical toolbar and select a color.
c Make the boilerplate object 1.8 inches wide and center it horizontally
and vertically in the repeating frame.
Select the boilerplate object in the Layout Model editor and
choose Arrange—>Size Objects from the menu. Select Custom
for the width and No Change for the height. Enter the width in
the field below.
Select both the boilerplate object and the repeating frame and
choose Arrange—>Align Objects from the menu.
d Add spacing between the labels: .25 inch between each column of
labels across the page; .5 inch between each row of labels down the
page.
Select the repeating frame and open the property palette. Set
Horizontal Space Between Frames to .25 and Vertical Space
Between Frames to .5.
e Save the report as p11q1.rdf.

......................................................................................................................................................
A-58 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 11
......................................................................................................................................................

2 Continue with report p11q1.rdf.


Modify the report so that only six labels are printed on each page.
a
Select the repeating frame and open the property palette. Set
Maximum Records per Page to 6.
b Save the report as p11q2.rdf and close it.
3 Open p9q1.rdf .
a On the operating system copy the file summitlo.tif to a file
logo.tif.
Ask your instructor for help, because this is operating-system
specific.
b Delete the logo in the margin area and create a link file in its place to
display the contents of logo.tif.
Choose Margin from the horizontal toolbar, or choose Layout
Section—>Margin View from the menu.
Select the logo boilerplate object and press [Delete].
Choose the Link File tool from the vertical toolbar and create an
external boilerplate object in the margin region where the logo
was.
Set the following properties:

Property Value
Name B_logo
Source File Format Image
Source File Name logo.tif

c Run the report.


d On the operating system copy any other .tif file to logo.tif.
Ask your instructor for help, because this is operating-system
specific.
e Rerun your report.
f Save the report as p11q3.rdf.

......................................................................................................................................................
Oracle Developer: Build Reports A-59
Appendix A: Solutions
......................................................................................................................................................

4 Continue with report p11q3.rdf.


a Ensure that all items of one order are printed on the same page.
Choose Body from the horizontal toolbar, or choose Layout
Section—>Body View from the menu.
Open the property palette for the repeating frame R_G_ID, and
set the property Page Protect to Yes.
b Save the report as p11q4.rdf and close it.

......................................................................................................................................................
A-60 Oracle Developer: Build Reports
Practice Session Overview: Lesson 12
......................................................................................................................................................

Practice Session Overview: Lesson 12


This practice session contains:
• Modifying an existing report to use a bind parameter
• Adding a dynamic list of values
• Adding a lexical parameter
• Adding a static list of values
• Creating a customized parameter form

Introduction
In this practice session, you create bind and lexical parameters to restrict
records in the report. You add lists of values to select valid values at run
time.
You then create your own default parameter form and customize it to include
extra text and graphics.

......................................................................................................................................................
Oracle Developer: Build Reports A-61
Appendix A: Solutions
......................................................................................................................................................

Practice Session Solutions: Lesson 12


1 Open report p11q3.rdf.
a In the Report Wizard add the following columns from the
S_CUSTOMER table. Create a new group for the customer
information above the Order group.

Column Label Width


NAME 30
ADDRESS 30
CITY 30

Create a reference to a bind parameter P_CUSTOMER in the query


to restrict orders to the parameter value you input at run time.
Note how Reports creates the parameter automatically.
Add the following to the WHERE clause of the query:
AND s_customer.id =:p_customer

Run and test the report with valid customer IDs.


b
Choose any number in the range 201 to 215.
c Save the report as p12q1.rdf. Do not close it.
2 Continue with report p12q1.rdf.
Add a list of values to select any valid customer ID in the
S_CUSTOMER table. Do not allow users to enter any other value.
The list should display customer names, not ID numbers.
In the Object Navigator, expand the Data Model node and the
User Parameter node.
Open the property palette for the P_CUSTOMER parameter
and make sure that the datatype is Number.
In the parameter property palette, choose List of Values.
In the dialog box, choose Select Statement.
Make sure that the Restrict List to Predetermined Values check
box is selected.

......................................................................................................................................................
A-62 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 12
......................................................................................................................................................

Select the Hide First Value check box.


Enter the following statement in the Enter Query area:
SELECT id, name
FROM s_customer
ORDER BY name

Run and test the report with different values.


d
e Save the report as p12q2.rdf. Do not close it for the moment.
3 Open report p5q3.rdf.
a Create a lexical parameter to enable users to order the data by
different columns (or not at all) at run time. Replace the ORDER BY
clause in the query with a lexical reference to the parameter. Type in
an initial value for the parameter to order by the employee’s last
name.
In the Object Navigator, expand the Data Model node. Double-
click the User Parameter node to create a parameter.
Select the parameter name P_1 and change it to P_ORDER.
Open the parameter property palette.
Make sure that the datatype is Character and increase the width
to 50.
Enter an Initial Value:
ORDER BY s_emp.last_name
In the Data Model, open the query property palette and add the
following lexical reference to the end of the query:
&P_ORDER
b Add a static list of values. Code two or three alternative ORDER BY
clauses. Allow any clause to be entered at run time.
In the parameter property palette choose List of Values.
In the dialog box choose Static Values and enter other ORDER
BY clauses in the Value field; for example:
ORDER BY s_emp.last_name
ORDER BY s_emp.title
For each value, remember to choose Add>> to add the value to
the list.
Clear the Restrict List to Predetermined Values check box.

......................................................................................................................................................
Oracle Developer: Build Reports A-63
Appendix A: Solutions
......................................................................................................................................................

Run the report to test.


c
Select an ORDER BY clause from the list.
Enter your own ORDER BY clause.
Delete the default parameter value.
d Save the report as p12q3.rdf and close it.
4 Continue with report p12q2.rdf.
a Create a default parameter form.
Include a Title message but not a Hint message.
Display the parameters DESNAME and P_CUSTOMER.
Select Tools—>Parameter Form Builder from the menu.
Enter your own Title message. Delete the Hint message.
Select DESNAME.
P_ORDER is already selected.
b Use your imagination to customize the form in the Parameter Form
editor.
Make sure that the parameter P_CUSTOMER is placed in a
prominent position for user entry.
Add some graphics; modify colors and fill patterns.
No formal solution.
c Run the report to test.
d Save the report as p12q4.rdf and close it.

......................................................................................................................................................
A-64 Oracle Developer: Build Reports
Practice Session Overview: Lesson 13
......................................................................................................................................................

Practice Session Overview: Lesson 13


This practice session contains:
• Using the Chart Wizard to create a chart in an existing report
• Altering the chart with the Chart Wizard
• Creating charts in an existing report that will be printed once for each
record of a group

Introduction
In this practice session you open existing reports to add charts using the
Chart Wizard. You also reenter the Chart Wizard to change the
characteristics of a chart.

......................................................................................................................................................
Oracle Developer: Build Reports A-65
Appendix A: Solutions
......................................................................................................................................................

Practice Session Solutions: Lesson 13


1 Open report p12q1.rdf.
a Remove all reference to the parameter P_CUSTOMER from the
query.
Open the Data Model editor.
Use the right mouse button to open the Query dialog box.
Delete the row:
AND S_CUSTOMER.ID = :P_CUSTOMER
b Rename SumLine_totalPerNAME to Total (a shorter name looks
better in a chart).
Open the property palette for SumLine_totalPerNAME to
change the name, or make the change in the Object Navigator.
c Use the Chart Wizard to create a line chart.
Choose Tools—>Chart Wizard from the menu and enter the
following properties in the wizard pages:
Chart Type Line
Chart Subtype Plain
Category NAME
Value TOTAL
Position At the beginning of the report
File Name p13q1.ogd

d Run report to test. Resize the chart if necessary.


e Close the Graphics Batch.
f Save report to p13q1.rdf.

......................................................................................................................................................
A-66 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 13
......................................................................................................................................................

2 Reenter the Chart Wizard to change the characteristics of the chart


created in the previous exercise.
Make sure that the chart is selected; otherwise you will create a new
chart.
Choose Chart Wizard from the horizontal toolbar or Tools—>
Chart Wizard from the menu.
a Give the chart the following characteristics:
Enter the following properties in the wizard pages:
Title Ordertotal per Customer
Chart Style Column
Chart Subtype Depth

Run the report to test.


b
c Close the Graphics Batch.
d Save report to p13q2.rdf and close it.
3 Open report p8q5.rdf.
a Use the Chart Wizard to create a pie chart for the data group
G_PRODUCT.
Choose Chart Wizard from the horizontal toolbar or Tools—>
Chart Wizard from the menu, and enter the following properties
in the wizard pages:
Chart Type Pie
Chart Subtype Plain
Data Group G_product
Category PRODUCT_ID
Value PROD_TOTAL
Chart Frequency Once per Name
File Name p13q3a.ogd

......................................................................................................................................................
Oracle Developer: Build Reports A-67
Appendix A: Solutions
......................................................................................................................................................

b In the Layout editor move the chart beneath the product group and
resize it to the same width as the product group.
Select the chart and drag it below the product group frame. You
must enable Flex Mode. Do not forget to turn it off again when
you have finished.
Select the group frame and the chart and choose Arrange—>
Size Objects from the menu to resize the chart.
c Run and test the report.
d Close the Graphics Batch.
e Create a second chart for the customer group.
Choose Chart Wizard from the horizontal toolbar or Tools—>
Chart Wizard from the menu, and enter the following properties
in the wizard pages:
Chart Type Pie
Chart Subtype Plain
Data Group G_customer
Category CUSTOMER_ID
Value CUST_TOTAL
Chart Frequency Once per Name
File Name p13q3e.ogd

f In the Layout editor move the chart beneath the customer group.
Select the chart and drag it below the product group frame. You
must enable Flex Mode. Do not forget to turn it off again when
you have finished.
g Run and test the report.
h Close the Graphics Batch.
i Save the report to p13q3.rdf and close it.

......................................................................................................................................................
A-68 Oracle Developer: Build Reports
Practice Session Overview: Lesson 14
......................................................................................................................................................

Practice Session Overview: Lesson 14


This practice session contains:
• Opening and changing an existing matrix report
• Building a nested matrix report
• Adding summaries to the nested matrix report
• Displaying zeros for summary values and restricting the number of
columns per page
• Displaying more meaningful column information and rotating the text

Introduction
In this practice session you use an existing matrix report to investigate the
different methods of displaying the cell values and the implications. You use
an existing external query to create a nested matrix report. You then add
row- and column-level summaries to the report and display zeros for null
values.
If you have time, include the product names instead of the product IDs and
rotate the names.

......................................................................................................................................................
Oracle Developer: Build Reports A-69
Appendix A: Solutions
......................................................................................................................................................

Practice Session Solutions: Lesson 14


1 Open report p4q6.rdf.
aUse the Report Wizard to apply a template file to the report. The file
corpmat.tdf should be located in your working directory. The new
template gives you spaces between the layout objects to make it
easier to see the different objects in the Layout editor.
b How many repeating frames do you have?
There are two repeating frames, R_G_NAME and
R_G_PRODUCT_ID.
c Change the properties of the cell object to display zero for a null
value.
Open the property palette for F_SumTOTAL_VALUE and set
Value if Null to 0.
d Run and test the report.
All cells without a value now display 0.
e Close the report without saving it.
2 Create a new report, importing the external query p4q6.sql from your
working directory.
Choose File—>New—Report from the menu, or open a new report
in the Object Navigator. Use the Report Wizard.
a Choose the following settings:
Report Style Matrix
Query Import file p4q6.sql
Matrix Row Fields Level 1 - Month
Level 2 - Name
Matrix Column Fields Product_id
Matrix Cell Fields Sum of total_value
Matrix Totals Sum of the cell field

......................................................................................................................................................
A-70 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 14
......................................................................................................................................................

b Change the labels and widths for the following fields:

Field Label Width


NAME Customer 10
PRODUCT_ID Product 5
MONTH Month 4
SUMTOTALVALUE Total 5
All Summaries Total: 5

c Run the report.


d Which summaries were created?
SumTOTAL_VALUEPerName
SumTOTAL_VALUEPerPRODUCT_ID
SumTOTAL_VALUEPerReport
These are the row, the column, and the report summaries.

......................................................................................................................................................
Oracle Developer: Build Reports A-71
Appendix A: Solutions
......................................................................................................................................................

e Use the Data Model editor to create summaries for each month and
for the level month and product.
Create both summaries in the cross product group.
Use the following settings:

Property Value
Name SumMonth
Product Order G_MONTH
Function Sum
Source SumTOTAL_VALUE
Reset At G_MONTH

Property Value
Name SumMonthProduct
Product Order G_MONTH G_PRODUCT_ID
Function Sum
Source SumTOTAL_VALUE
Reset At G_PRODUCT_ID

f Use the Layout editor to create the fields. You must expand the
appropriate repeating frame.
Select and expand R_G_MONTH. You must enable Flex Mode.
Do not forget to disable it again when you have finished.
Choose the Field tool from the vertical toolbar.
Create a field below F_SumTOTAL_VALUE. Position the field
in the R_G_MONTH and the R_G_PRODUCT_ID repeating
frames.
Set the following properties:
Property Value
Name F_SumMonthProduct
Source SumMonthProduct

......................................................................................................................................................
A-72 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 14
......................................................................................................................................................

Choose the Field tool from the vertical toolbar.


Create a field below F_SumSumTOTAL_VALUEPerNAME.
Position the field in the R_G_MONTH repeating frame but
outside any other repeating frames.
Set the following properties:

Property Value
Name F_SumMonth
Source SumMonth

Run and test the report.


g
h Save the report as p14q2.rdf. Do not close it.
3 Continue with the report from the previous exercise.
a Add zeros for null values in the cells.
Open the property palette for F_SumTOTAL_VALUE and set
Value if Null to 0.
b Ensure that the report shows only three product columns on each
page.
Open the property palette for R_G_PRODUCT_ID and set
Maximum Records per Page to 3.
c Format all numeric data to be right aligned.
Use the style bar.
d Add commas and two decimal places where appropriate.
Use the style bar.
e Run and test the report.
f Save the report as p14q3.rdf and close it.

If You Have Time


4 Open the report as p14q3.rdf.
a Make the necessary changes in the Data Model editor to include the
product name.

......................................................................................................................................................
Oracle Developer: Build Reports A-73
Appendix A: Solutions
......................................................................................................................................................

Use the right mouse button to open the Query dialog box.
The query should read:
SELECT S_CUSTOMER.NAME
, S_ITEM.PRODUCT_ID
, SUM(S_ITEM.PRICE*S_ITEM.QUANTITY_SHIPPED) TOTAL_VALUE
, TO_CHAR(S_ORD.DATE_ORDERED, ’MM/RR’) MONTH
, S_PRODUCT.NAME PRODUCT
FROM S_CUSTOMER, S_ITEM, S_ORD, S_PRODUCT
WHERE S_ITEM.PRODUCT_ID LIKE ’4%’
AND S_ITEM.ORD_ID=S_ORD.ID
AND S_PRODUCT.ID=S_ITEM.PRODUCT_ID
AND S_ORD.CUSTOMER_ID=S_CUSTOMER.ID
GROUP BY S_CUSTOMER.NAME
, S_ITEM.PRODUCT_ID
, TO_CHAR(S_ORD.DATE_ORDERED, ’MM/RR’)
, S_PRODUCT.NAME

b In the Layout Model editor delete the product_id field and insert a
boilerplate object to display the product name. Rotate this object by
90 degrees.
Select F_PRODUCT_ID and press [Delete].
Choose the Text tool from the vertical toolbar and create a text
object in the place of the F_PRODUCT_ID field.
Enter: &PRODUCT.
Select the boilerplate object.
Choose the Rotate tool from the vertical toolbar.
Press [Shift] and click the boilerplate object to rotate it by 90
degrees.
Open the property palette for the boilerplate object and set
Vertical and Horizontal Elasticity to Variable.
c Run and test the report.
d Save the report as p14q4.rdf and close it.

......................................................................................................................................................
A-74 Oracle Developer: Build Reports
Practice Session Overview: Lesson 15
......................................................................................................................................................

Practice Session Overview: Lesson 15


This practice session contains:
• Creating a format trigger to conditionally display different layouts
• Creating and use a report-level PL/SQL function
• Creating and use an external PL/SQL library
• Creating a PL/SQL group filter

Introduction
In this practice session, you create a format trigger to conditionally flag one
of two layout versions for the same data. You also conditionally flag some
records in a report by creating and referencing a report-level (local) PL/SQL
function. You then move the code into a new PL/SQL library and alter the
reference to use the library function instead.
If you have time, restrict the number of records processed in a report by
creating your own group filter.

......................................................................................................................................................
Oracle Developer: Build Reports A-75
Appendix A: Solutions
......................................................................................................................................................

Practice Session Solutions: Lesson 15


1 Create a new report, using p15q1.sql.
a Display the records in two different layouts, showing different
columns in each.
b Create a Group Above layout using the following columns from the
query:
Create a new report, using the Report Wizard.
Import the SQL Query from file p15q1.sql.
Display the following fields. Choose Labels and other properties
as you wish.

Group Column
G_CUSTOMER CUSTOMER_ID
G_ID ID
DATE_ORDERED
DATE_SHIPPED
PAYMENT_TYPE
TOTAL

c Create a Tabular layout using the following columns from the query:
In the Layout Model editor choose the Additional Default
Layout tool from the vertical toolbar.
Display the following fields. Choose Labels and other properties
as you wish.

Column
ID
DATE_ORDERED
DATE_SHIPPED
TOTAL

......................................................................................................................................................
A-76 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 15
......................................................................................................................................................

d Ensure that only the Group Above layout is displayed when you
choose a destination of Screen, and that only the Tabular layout is
displayed when you choose a destination of Preview.
Create a format trigger on the M_G_CUSTOMER_ID_GRPFR
group frame in the first layout or use conditional formatting.
function M_G_CUSTOMER_ID_GRPFRFormatTrigger return BOOLEAN is
begin
if:destype = ’Screen’ then
return(true);
else
return(false);
end if;
end;
Create a format trigger on the M_G_ID_GRPFR1 group frame
in the second layout with the reverse logic or use conditional
formatting:
function M_G_ID_GRPFR1FormatTrigger return BOOLEAN is
begin
if :destype = ’Preview’ then
return(true);
else
return(false);
end if;
end;
Create an anchor from the top edge of the second layout group
frame up to the bottom edge of the first layout group frame.
Open the anchor property palette, and set the Collapse Vertically
property to Yes.
Alternatively, ensure that there is almost no space between the
two layouts, so that there is no extra white space at the top of the
report when the second layout is output.
To test the result, display the DESTYPE parameter in the report.
Create a field to display the system parameter DESTYPE.
Ensure that you can enter a parameter value at run time.
Choose Tools—>Parameter Form Builder from the menu to
create a parameter form.
Test the report by changing the Destination Type parameter on
the Runtime Parameter Form.
e Save the report as p15q1.rdf.

......................................................................................................................................................
Oracle Developer: Build Reports A-77
Appendix A: Solutions
......................................................................................................................................................

2 Continue with the previous report.


a Modify the report so that the Tabular (Preview) layout displays an
extra column that indicates, with an asterisk, those orders that were
shipped more than 15 days after the order date.
Create a new Program Unit, either from the Tools menu or in the
Object Navigator. Create a function called ASTERISK:
function asterisk(odate date, sdate date)
return varchar2 is
begin
if odate + 15 < sdate then
return(’*’);
else
return(’’);
end if;
end;
In the Data Model editor, create a formula column in the detail group
G_ORD.
Open the property palette and alter the following properties for the
column CF_ASTERISK:

Name Datatype Width


CF_ASTERISK Character 1

Click PL/SQL Formula to open the PL/SQL editor, and call the ASTERISK
function from the formula.
function CF_asteriskFormula return varchar2 is
begin
return(asterisk(:date_ordered,:date_shipped));
end;

In the Layout editor, increase the width of the R_G_ID1 repeating frame
in the second layout to allow room for another field.
Create a field inside the repeating frame, rename it F_CF_ASTERISK,
and source it to CF_ASTERISK.
b Remember to change destination to Preview during testing.
Save the report and test it.

......................................................................................................................................................
A-78 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 15
......................................................................................................................................................

Move the function code into a new PL/SQL library named


c
p15lib.pll.
In the Object Navigator, create a new library.
Open the Library node and click and drag the ASTERISK
function into the Program Unit node below the library.
Delete the report-level ASTERISK function. Attach the library
to the report.
d Call the external function from your report instead of calling the
report-level function.
e Save the report to p15q2.rdf.
3 Continue with the previous report.
a Modify the same layout to display additional spacing between every
two records.
b Save the report as p15q3.rdf and close it.

......................................................................................................................................................
Oracle Developer: Build Reports A-79
Appendix A: Solutions
......................................................................................................................................................

If You Have Time


4 Open report p15q1.rdf.
a Write your own group filter to restrict the number of customers
displayed depending on the value of a parameter that you enter at
runtime.
Hint: You need to create two parameters, to keep track of how many
records have been processed compared to the cutoff number of
records required.
In the Object Navigator, open the Data Model node, and
double-click the User Parameters node to create the first
parameter.
Choose the Create tool to create a second parameter.
Rename the parameters P_COUNT_CUST and P_CUTOFF.
Give P_COUNT_CUST an initial value of 0.
Open the G_CUSTOMER_ID group property palette.
Set Filter Type to PL/SQL
Choose PL/SQL Filter to open the PL/SQL editor.
Enter the following code:
function G_CUSTOMER_IDGroupFilter return boolean is
begin
:p_count_cust := :p_count_cust + 1;
if :p_count_cust <= nvl(:p_cutoff, :p_count_cust) then
return(TRUE);
else
return(FALSE);
end if;
end;

b Test the report several times by changing the cutoff parameter at


runtime.
c Save the report as p15q4.rdf.

......................................................................................................................................................
A-80 Oracle Developer: Build Reports
Practice Session Overview: Lesson 16
......................................................................................................................................................

Practice Session Overview: Lesson 16


This practice session contains:
• Building a report containing conditional highlighting
• Building a drill-down report
• Writing to a temporary table from a report

Introduction
In this practice session, you highlight values based on conditional PL/SQL
code.
You build a master report that enables you to call a separate report from a
button in the previewer.
If you have time, you add report-level triggers to an existing report to write
messages to a temporary table at various stages of report execution.
Write PL/SQL functions as local PL/SQL (report-level), and reference the
code in a condition within the relevant object trigger in the report.

......................................................................................................................................................
Oracle Developer: Build Reports A-81
Appendix A: Solutions
......................................................................................................................................................

Practice Session Solutions: Lesson 16


1 Open report p8q5.rdf.
a Display the column CUST_TOTAL in the customer group as red,
bold italics if its value is 10,000 or more.
Hint: Check the Help system for the SRW.SET <attributes> or use
conditional formatting.
Mask Attribute Suggested Value
SRW.SET_TEXT_COLOR Red
SRW.SET_FONT_WEIGHT SRW.BOLD_WEIGHT
SRW.SET_FONT_STYLE SRW.ITALIC_STYLE

You can import the file p16q1a.txt.


Open the PL/SQL editor and create a function to apply the
format attributes.
function FIELD_MASK return boolean is
begin
srw.set_text_color(’red’);
srw.set_font_weight(srw.bold_weight);
srw.set_font_style(srw.italic_style);
return(TRUE);
end;

......................................................................................................................................................
A-82 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 16
......................................................................................................................................................

b Alter the pattern and color of those records where the customer total
is 5000 or less.
Hint: Check the help system for the SRW.SET <attributes> or use
conditional formatting.
Attribute Suggested Values
Fill pattern Crisscross, sandpaper
Foreground fill color Yellow
Background fill color Green

You can import the file p16q1b.txt.


Open the PL/SQL editor and create a function to apply the
format attributes.
function RECORD_MASK return boolean is
begin
srw.set_foreground_fill_color(‘yellow’);
srw.set_background_fill_color(‘green’);
srw.set_fill_pattern(‘crisscross’);
return(TRUE);
end;

......................................................................................................................................................
Oracle Developer: Build Reports A-83
Appendix A: Solutions
......................................................................................................................................................

c Write the necessary format triggers.


Create a format trigger on the F_CUST_TOTAL field to call the
function.
function F_CUST_TOTALFormatTrigger return boolean is
begin
if :cust_total >= 10000 then
return(field_mask);
else
return(TRUE);
end if;
end;

Create a format trigger on the R_G_CUSTOMER repeating frame to call


the function.

function R_G_CUSTOMERFormatTrigger return boolean is


begin
if :cust_total <= 5000 then
return(record_mask);
else
return(TRUE);
end if;
end;

d Save the report as p16q1.rdf.

......................................................................................................................................................
A-84 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 16
......................................................................................................................................................

2 Call a drill-down report using a button.


a Continue with the previous report.
b Alter query Q_2 to include the customer ID, but do not display it in
the report.
Use the right mouse button to open the Query dialog box.
The query should read:
SELECT S_ORD.SALES_REP_ID
, S_CUSTOMER.NAME CUSTOMER
, SUM(S_ORD.TOTAL) CUST_TOTAL
, S_ORD.CUSTOMER_ID
FROM S_ORD, S_CUSTOMER
WHERE S_ORD.CUSTOMER_ID=S_CUSTOMER.ID
GROUP BY S_ORD.SALES_REP_ID
, S_CUSTOMER.NAME
, S_ORD.CUSTOMER_ID

Add a button to this report to display a drill-down report when the button is
chosen at run time. The button should be displayed once for every customer
record.
In the Layout editor, increase the width of the R_G_CUSTOMER
repeating frame to allow room for the button.
Create a button inside the repeating frame.
c When the button is chosen, the detail report (p12q1.rdf) is called
with the customer ID as a parameter.
Hint: Have a look at report p12q1.rdf to check the name of the
parameter.
You can import the file p16q2d.txt.
Open the property palette for the button and set the Type
property to PL/SQL.
Import the file p16q2d.txt into the PL/SQL code, or enter the
following code:

procedure U_1ButtonAction is
begin
srw.run_report(’report=s12q1.rdf
p_customer=’||to_char(:customer_id)||’ paramform=no’);
end;

......................................................................................................................................................
Oracle Developer: Build Reports A-85
Appendix A: Solutions
......................................................................................................................................................

d Save the report as p16q2.rdf.


e Test the report using the run time executable and then close the run
time.

If You Have Time


3 Open report p9q1.rdf.
In this report, you use report triggers to create a temporary table at the start
of report execution, and you insert rows into the table at various stages of the
execution.
a Write a trigger that creates a temporary table to hold the date and
userid each time the report is run. The table should contain three
columns: one date column, one character column of width 10, and
one character column of width 80.
CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN VARCHAR2(10), COMMENTS VARCHAR2(80)

In the Object Navigator, expand the Report Triggers node, and


double-click the Before Report PL/SQL icon to open the PL/SQL editor.
Create the following function:
function BeforeReport return boolean is
begin
srw.do_sql(’CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN VARCHAR2(10),
COMMENTS VARCHAR2(80))’);
exception
when srw.do_sql_failure then null;
end;

......................................................................................................................................................
A-86 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 16
......................................................................................................................................................

b The same trigger should also insert the current date, userid, and
“Starting Report” into this table.
INSERT INTO RUNREPORT
( DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER, ’Starting Report’)

Hint: Think about how you code the single quotes.


Add the following code:
function BeforeReport return boolean is
begin
srw.do_sql(’CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN VARCHAR2(10),
COMMENTS VARCHAR2(80))’);
srw.do_sql(’INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER,
’’Starting Report’’)’);
return(TRUE);
end;

c Save the report as p16q3.rdf.


d Compile the PL/SQL and run the report. Be sure to view more than
one page.
e Run and test the report.
f Using SQL*Plus, verify that your table exists and was populated
successfully.
g Log on to SQL*Plus (in Microsoft Windows, select the SQL*Plus
icon in the Oracle group) using the same userid as you used for
Reports.
h Display all records in the RUNREPORT table.
SQL> col comments format a40
SQL> SELECT * FROM RUNREPORT;

......................................................................................................................................................
Oracle Developer: Build Reports A-87
Appendix A: Solutions
......................................................................................................................................................

i Try running the report more than once. When you run the report a
second time, the table already exists and Report Builder raises an
exception. Make the necessary change to your code so that the report
runs even when the table exists.
You need two PL/SQL blocks so that, if the table already exists,
the record is inserted after the exception has been handled.
Add the following code:
function BeforeReport return boolean is
begin
begin
srw.do_sql(’CREATE TABLE RUNREPORT
(DATE_RUN DATE, USER_RUN VARCHAR2(10),
COMMENTS VARCHAR2(80))’);
exception
when srw.do_sql_failure then
null;
end;
begin
srw.do_sql(’INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER,
’’Starting Report’’)’);
return(TRUE);
end;
end;

......................................................................................................................................................
A-88 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 16
......................................................................................................................................................

j Write a trigger that inserts a record with the comment “Printing


another page” whenever it begins a new page.
In the Object Navigator, expand the Report Triggers node, and
double-click the Between Pages PL/SQL icon to open the
PL/SQL editor.
Or, if the editor is already open, change the Name to Between
Pages.
Create the following function.
function BetweenPage return boolean is
begin
srw.do_sql(’INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER,
’’Printing another page’’)’);
return(TRUE);
end;

k Write a trigger that inserts a record with the comment “Report


completed” when the report finishes. Save and run the report.
In the Object Navigator, expand the Report Triggers node and
double-click the After Report PL/SQL icon to open the PL/SQL
editor.
Or, if the editor is already open, change the Name to After Pages.
Report the following function:
function AfterReport return boolean is
begin
srw.do_sql(’INSERT INTO RUNREPORT
(DATE_RUN, USER_RUN, COMMENTS)
VALUES (SYSDATE, USER,
’’Report Completed’’)’);
return(TRUE);
end;

l Verify the results in SQL*Plus.

......................................................................................................................................................
Oracle Developer: Build Reports A-89
Appendix A: Solutions
......................................................................................................................................................

Practice Session Overview: Lesson 17


This practice session contains:
• Running a report on your local machine
• Running reports on a remote server using the report Queue Manager
• Copying output from remote server to your local machine
• Running a report on a remote server using the command line

Introduction
In this practice session you run a report locally and then on a remote server,
using the Queue Manager. You also use the Queue Manager to view the
submitted jobs.
If you have time, you can submit a report to a remote server using the
command line options.

......................................................................................................................................................
A-90 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 17
......................................................................................................................................................

Practice Session Solutions: Lesson 17


1 Run longrun1.rdf on your local client machine.
Open longrun1.rdf and run the report. Notice the time it takes for
a
the report to run to completion. If it has not completed within five
minutes, note how many pages have been formatted, then cancel the
report.
Note: Make sure that DESTYPE=FILE is set in the Parameter Form
when running this report.
2 Run longrun1.rdf and longrun2.rdf by calling the Reports Server
from the Queue Manager.
Note: Your instructor will give you specific instructions to complete this
exercise. The location of the remote server, directory paths, and so on
might differ for your class.
a Invoke the Queue Manager. Enter repserver1 as your server name.
Note if there are any jobs in the queue.
b Schedule a new job to run longrun1.rdf report on the Reports
Server. Choose applicable settings from the tab pages of the Queue
Manager. For Destination Type choose ToLocalFile, ToFile, or
Cache; the report default is Screen, which is not valid when running
a remote report.
Choose Job—>New from the menu, then choose Set Options.
In the dialog box enter the following information:

Tab Parameter Value


General Report Name longrun1.rdf

Type 7 - ToServerCache
Data Connection User Name Your User Name
Password Your Password
Database Your Database
Output Options Output Driver PDF

......................................................................................................................................................
Oracle Developer: Build Reports A-91
Appendix A: Solutions
......................................................................................................................................................

c Do the same for longrun2.rdf.


Choose Job—>New from the menu, then choose Set Options.
In the dialog box enter the following information:

Tab Parameter Value


General Report Name longrun2.rdf

Type 7 - ToServerCache
Data Connection User Name Your User Name
Password Your Password
Database Your Database
Output Options Output Driver PDF

dDisplay all jobs to see where your jobs are queued in relation to the
reports of other students.
Choose Show All Jobs from the toolbar if it is not selected.
e Display all your own jobs only.
Choose Show All My Jobs from the toolbar.
f Refresh the screen several times to see how quickly the report pages
are formatted.
Choose Refresh from the toolbar
g Cancel your own longrun2.rdf from the server queue.
Select the job and choose Job—>Remove from the menu.
3 When the report longrun1.rdf has finished, copy the output to a
filename, longrun1.pdf, in your home directory.
When the job has finished, it is no longer displayed in the Current
Jobs window.
Choose Show Past Jobs from the toolbar.
Select the job and choose Job—>Copy Output To from the menu.
Choose your home directory.
Enter the filename longrun1.pdf and choose Save.

......................................................................................................................................................
A-92 Oracle Developer: Build Reports
Practice Session Solutions: Lesson 17
......................................................................................................................................................

If You Have Time


4 Run longrun1.rdf by scheduling a new job from the command line.
a Using RWCLI60 from the command line, submit your
longrun1.rdf report to the Reports Server.
Your instructor will give you specific instructions to complete
this exercise because this is operating-system specific.
b Make sure that the output is in PDF format and that it is cached.
On Windows platforms enter the following command:
RWCLI60 LONGRUN1.RDF USERID=<userid>/<password>
@<alias> SERVER=repserver1 DESTYPE=CACHE DESFORMAT=PDF

......................................................................................................................................................
Oracle Developer: Build Reports A-93
Appendix A: Solutions
......................................................................................................................................................

......................................................................................................................................................
A-94 Oracle Developer: Build Reports
B
................................

Table Descriptions and


Data
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

Summit Sporting Goods Database Diagram

ORD_ID
ID
S_ITEM S_ORD

PRODUCT_ID CUSTOMER_ID
SALES_REP_ID

S_INVENTORY
*
PRODUCT_ID
ID

ID ID
S_CUSTOMER
S_PRODUCT SALES_REP_ID

IMAGE_ID

ID ID ID

S_IMAGE S_EMP
DEPT_ID

ID

S_DEPT

*Unique occurrences are identified by PRODUCT_ID and


WAREHOUSE_ID.

......................................................................................................................................................
B-2 Oracle Developer: Build Reports
S_CUSTOMER Description
.....................................................................................................................................................

S_CUSTOMER Description
Column Name Null? Datatype
-------------- --------- ------------- -----------------
ID NOT NULL NUMBER(7)
NAME NOT NULL VARCHAR2(50)
PHONE VARCHAR2(25)
ADDRESS VARCHAR2(400)
CITY VARCHAR2(30)
STATE VARCHAR2(20)
COUNTRY VARCHAR2(30)
ZIP_CODE VARCHAR2(75)
CREDIT_RATING VARCHAR2(9)
SALES_REP_ID NUMBER(7)
REGION_ID NUMBER(7)
COMMENTS VARCHAR2(255)

......................................................................................................................................................
Oracle Developer: Build Reports B-3
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_CUSTOMER Data

SQL> SELECT * FROM s_customer;

Id Name Phone Address


------ ------------------ ------------ -----------
City State Country
------------------ ---------------- -----------
Zip_code Credit_ra Sales_rep_id Region_id
---------- --------- ------------ ---------
Comments
--------------------------------------------------
201 Unisports 55-2066101 72 Via Bahia
Sao Paolo Brazil
Excellent 12 2
Customer Usually Orders Large Amounts And Has A High Order
Total. This Is Okay As Long As The Credit Rating Remains
Excellent.

202 Oj Atheletics 6741 Takashi Blvd. 81-20101


Osaka Japan
Poor 14 4
Customer Should Always Pay By Cash Until His Credit Rating
Improves.

203 Delhi Sports 91-10351 11368 Chanakya


New Delhi India
Good 14 4
Customer Specializes In Baseball Equipment And Is The Largest
Retailer In India.

......................................................................................................................................................
B-4 Oracle Developer: Build Reports
S_CUSTOMER Data
.....................................................................................................................................................

S_CUSTOMER Data (continued)

Id Name Phone Address


------ ------------------ ------------ -----------
City State Country
------------------ ---------------- -----------
Zip_code Credit_ra Sales_rep_id Region_id
---------- --------- ------------ ---------
Comments
--------------------------------------------------
204 Womansport 1-206-104-0103 281 King Street
Seattle Washington USA
98101 EXCELLENT 11 1

205 Kam’s Sporting Goods 852-3692888 15 Henessey Road


Hong Kong EXCELLENT 15 4

206 Sportique 172 Rue de Rivoli 33-2257201


Cannes France
EXCELLENT 15 5
Customer specializes in Soccer. Likes to order accessories in
bright colors.

207 Sweet Rock Sports 234-603620 6 Saint Antoine


Lagos Nigeria

......................................................................................................................................................
Oracle Developer: Build Reports B-5
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_CUSTOMER Data (continued)

Id Name Phone Address


------ ------------------ ------------ -----------
City State Country
------------------ ---------------- -----------
Zip_code Credit_ra Sales_rep_id Region_id
---------- --------- ------------ ---------
Comments
--------------------------------------------------
208 Muench Sports 49-527454 435 Gruenestrasse
Stuttgart Germany
GOOD 15 5
Customer usually pays small orders by cash and large orders on
credit.

209 Beisbol Si! 809-352689 789 Playa Del Mar


San Pedro de Macon’s Dominican Republic
EXCELLENT 11 1

210 Futbol Sonora 52-404562 3 Via Saguaro


Nogales
EXCELLENT 12 2
Customer is difficult to reach by phone. Try mail.

211 Kuhn’s Sports 42-111292 7 Modrany


Prague Czechoslovakia
EXCELLENT 15 5

......................................................................................................................................................
B-6 Oracle Developer: Build Reports
S_CUSTOMER Data
.....................................................................................................................................................

S_CUSTOMER Data (continued)

Id Name Phone Address


------ ------------------ ------------ -----------
City State Country
------------------ ---------------- -----------
Zip_code Credit_ra Sales_rep_id Region_id
---------- --------- ------------ ---------
Comments
--------------------------------------------------
212 Hamada Sport 20-1209211 57A Corniche
Alexandria Egypt
EXCELLENT 13 3
Customer orders sea and water equipment.

213 Big John’s Sports 1-415-555-6281 4783 18th Street


Emporium
San Francisco CA USA
94117 EXCELLENT 11 1
Customer has a dependable credit record.

214 Ojibway Retail 1-716-555-7171 415 Main Street


Buffalo NY USA
14202 POOR 11 1

215 Sporta Russia 7-3892456 6000 Yekatamina


St. Petersburg Russia
POOR 15 5
This customer is very friendly, but has difficulty paying bills.
Insist upon cash.

Note: This display has been formatted.

......................................................................................................................................................
Oracle Developer: Build Reports B-7
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_DEPT Description and Data


Column Name Null? Datatype
---------------------- ------------- --------------
ID NOT NULL NUMBER(7)
NAME NOT NULL VARCHAR2(25)
REGION_ID NUMBER(7)

SQL> SELECT * FROM s_dept;

ID NAME REGION_ID
------ ---------------- -----------------
10 Finance 1
31 Sales 1
32 Sales 2
33 Sales 3
34 Sales 4
35 Sales 5
41 Operations 1
42 Operations 2
43 Operations 3
44 Operations 4
45 Operations 5
50 Administration 1

12 rows selected.

......................................................................................................................................................
B-8 Oracle Developer: Build Reports
S_EMP Description
.....................................................................................................................................................

S_EMP Description
Column Name Null? Datatype
------------------------ -------------- --------------
ID NOT NULL NUMBER(7)
LAST_NAME NOT NULL VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
COMMENT VARCHAR2(255)
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID NUMBER(7)
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)

......................................................................................................................................................
Oracle Developer: Build Reports B-9
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_EMP Data

SQL> SELECT * FROM s_emp;

ID LAST_NAME FIRST_NAME USERID START_DAT


---- ----------------- ---------------- -------- ---------
COMMENTS
--------------------------------------------------------------
MANAGER_ID TITLE DEPT_ID SALARY
---------- ---------------------------- ------- ------
COMMISSION_PCT
---------------
1 Velasquez Carmen cvelasqu 03-MAR-90
President 50 2500
2 Ngao LaDoris lngao 08-MAR-90
1 VP, Operations 41 1450

3 Nagayama Midori mnagayam 17-JUN-91


1 VP, Sales 31 1400

4 Quick-To-See Mark mquickto 07-APR-90


1 VP, Finance 10 1450

5 Ropeburn Audry aropebur 04-MAR-90


1 VP, Administration 50 1550

6 Urguhart Molly murguhar 18-JAN-91


2 Warehouse Manager 41 1200

7 Menchu Roberta rmenchu 14-MAY-90


2 Warehouse Manager 42 1250
8 Biri Ben bbiri 07-APR-90
2 Warehouse Manager 43 1100

9 Catchpole Antoinette acatchpo 09-FEB-92


2 Warehouse Manager 44 1300

......................................................................................................................................................
B-10 Oracle Developer: Build Reports
S_EMP Data
.....................................................................................................................................................

S_EMP Data (continued)

ID LAST_NAME FIRST_NAME USERID START_DAT


---- ----------------- ---------------- -------- ---------
COMMENTS
--------------------------------------------------------------
MANAGER_ID TITLE DEPT_ID SALARY
---------- ---------------------------- ------- ------
COMMISSION_PCT
---------------
10 Havel Marta mhavel 27-FEB-91
2 Warehouse Manager 45 1307

11 Magee Colin cmagee 14-MAY-90


3 Sales Representative 31 1400
10

12 Giljum Henry hgiljum 18-JAN-92


3 Sales Representative 32 1490
12.5

13 Sedeghi Yasmin ysedeghi 18-FEB-91


3 Sales Representative 33 1515
10

14 Nguyen Mai mnguyen 22-JAN-92


3 Sales Representative 34 1525
15

15 Dumas Andre adumas 09-OCT-91


3 Sales Representative 35 1450
17.5

16 Maduro Elena emaduro 07-FEB-92


6 Stock Clerk 41 1400

......................................................................................................................................................
Oracle Developer: Build Reports B-11
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_EMP Data (continued)

ID LAST_NAME FIRST_NAME USERID START_DAT


---- ----------------- ---------------- -------- ---------
COMMENTS
--------------------------------------------------------------
MANAGER_ID TITLE DEPT_ID SALARY
---------- ---------------------------- ------- ------
COMMISSION_PCT
---------------
17 Smith George gsmith 08-MAR-90
6 Stock Clerk 41 940

18 Nozaki Akira anozaki 09-FEB-91


7 Stock Clerk 42 1200

19 Patel Vikram vpatel 06-AUG-91


7 Stock Clerk 42 795

20 Newman Chad cnewman 21-JUL-91


8 Stock Clerk 43 750

21 Markarian Alexander amarkari 26-MAY-91


8 Stock Clerk 43 850

22 Chang Eddie echang 30-NOV-90


9 Stock Clerk 44 800

23 Patel Radha rpatel 17-OCT-90


9 Stock Clerk 34 795

24 Dancs Bela bdancs 17-MAR-91


10 Stock Clerk 45 860

25 Schwartz Sylvie sschwart 09-MAY-91


10 Stock Clerk 45 1100

Note: This display has been formatted.

......................................................................................................................................................
B-12 Oracle Developer: Build Reports
S_ITEM Description
.....................................................................................................................................................

S_ITEM Description
Column Name Null? Datatype
------------------------- -------------- ----------
ORD_ID NOT NULL NUMBER(7)
ITEM_ID NOT NULL NUMBER(7)
PRODUCT_ID NOT NULL NUMBER(7)
PRICE NUMBER(11,2)
QUANTITY NUMBER(9)
QUANTITY_SHIPPED NUMBER(9)

......................................................................................................................................................
Oracle Developer: Build Reports B-13
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_ITEM Data

SQL> SELECT * FROM s_item;

ORD_ID ITEM_ID PRODUCT_ID PRICE QUANTITY QUANTITY_SHIPPED


------ -------- ----------- ------ -------- -----------------
100 1 10011 135 500 500
100 2 10013 380 400 400
100 3 10021 14 500 500
100 5 30326 582 600 600
100 7 41010 8 250 250
100 6 30433 20 450 450
100 4 10023 36 400 400
101 1 30421 16 15 15
101 3 41010 8 20 20
101 5 50169 4.29 40 40
101 6 50417 80 27 27
101 7 50530 45 50 50
101 4 41100 45 35 35
101 2 40422 50 30 30
102 1 20108 28 100 100
102 2 202011 23 45 45
103 1 30433 20 15 15
103 2 32779 7 11 11
104 1 20510 9 7 7
104 4 30421 16 35 35
104 2 20512 8 12 12
104 3 30321 1669 19 19
105 1 50273 22.8 16 16
105 3 50532 47 28 28
105 2 50419 80 13 13

......................................................................................................................................................
B-14 Oracle Developer: Build Reports
S_ITEM Data
.....................................................................................................................................................

S_ITEM Data (continued)

ORD_ID ITEM_ID PRODUCT_ID PRICE QUANTITY QUANTITY_SHIPPED


------- ------- ----------- ------ -------- -----------------
106 1 20108 28 46 46
106 4 50273 22.89 75 75
106 5 50418 75 98 98
106 6 50419 80 27 27
106 2 20201 123 21 21
106 3 50169 4.29 125 125
107 1 20106 11 50 50
107 3 20201 115 130 130
107 5 30421 16 55 55
107 4 30321 1669 75 75
107 2 20108 28 22 22
108 1 20510 9 9 9
108 6 41080 35 50 50
108 7 41100 45 42 42
108 5 32861 60 57 57
108 2 20512 8 18 18
108 4 32779 7 60 60
108 3 30321 1669 85 85
109 1 10011 140 150 150
109 5 30426 18.25 500 500
109 7 50418 75 43 43
109 6 32861 60 50 50
109 4 30326 582 1500 1500
109 2 10012 175 600 600
109 3 10022 21.95 300 300
110 1 50273 22.89 17 17
110 2 50536 50 23 23
111 1 40421 65 27 27
111 2 41080 35 29 29
97 1 20106 9 1000 1000
97 2 303211 500 50 50
98 1 404218 5 7 7
99 1 20510 9 18 18
99 2 20512 8 25 25
99 3 50417 80 53 53
99 4 50530 45 69 69
112 1 20106 11 50 50

62 rows selected.

Note: This display has been formatted.


......................................................................................................................................................
Oracle Developer: Build Reports B-15
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_ORD Description and Data


Column Name Null? Datatype
------------------------ ------ ---------------------
ID NOT NULL NUMBER(7)
CUSTOMER_ID NOT NULL NUMBER(7)
DATE_ORDERED DATE
DATE_SHIPPED DATE
SALES_REP_ID NUMBER(7)
TOTAL NUMBER(11,2)
PAYMENT_TYPE VARCHAR2(6)
ORDER_FILLED VARCHAR2(1)

SQL> SELECT * FROM s_ord;

ID CUSTOMER_ID DATE_ORDE DATE_SHIPSALES_REP_IDTOTAL PAYMEN ORDER_F


--- ----------- --------- ---------------------------------- ------
100 204 31-AUG92 10-SEP-9211 601100 CREDIT Y
101 205 31-AUG-92 15-SEP-9214 8056.6 CREDIT Y
102 206 01-SEP-92 08-SEP-9215 8335 CREDIT Y
103 208 02-SEP-92 22-SEP-9215 377 CASH Y
104 208 03-SEP-92 23-SEP-9215 32430 CREDIT Y
105 209 04-SEP-92 18-SEP-9211 2722.24 CREDIT Y
106 210 07-SEP-92 15-SEP-9212 15634 CREDIT Y
107 211 07-SEP-92 21-SEP-9215 142171 CREDIT Y
108 212 07-SEP-92 10-SEP-9213 149570 CREDIT Y
109 213 08-SEP-92 28-SEP-9211 1020935 CREDIT Y
110 214 09-SEP-92 21-SEP-9211 1539.13 CASH Y
111 204 09-SEP-92 21-SEP-9211 2770 CASH Y
97 201 28-AUG-92 17-SEP-9212 84000 CREDIT Y
98 202 31-AUG-92 10-SEP-9214 595 CASH Y
99 203 31-AUG-92 18-SEP-9214 7707 CREDIT Y
112 210 31-AUG-92 10-SEP-9212 550 CREDIT Y

16 rows selected.

......................................................................................................................................................
B-16 Oracle Developer: Build Reports
S_PRODUCT Description
.....................................................................................................................................................

S_PRODUCT Description
Column Name Null? Datatype
---------------------------------- -----------------
ID NOT NULL NUMBER(7)
NAMENOT NULL VARCHAR2(50)
SHORT_DESC VARCHAR2(255)
LONGTEXT_ID NUMBER(7)
IMAGE_ID NUMBER(7)
SUGGESTED_WHLSL_PRICE‘ NUMBER(11,2)
WHLSL_UNITS VARCHAR2(25)

......................................................................................................................................................
Oracle Developer: Build Reports B-17
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_PRODUCT Data

SQL> SELECT * FROM s_product;

ID NAME SHORT_DESC LONGTEXT_ID


---- -------------------------- -----------
IMAGE_ID SUGGESTED_WHLSL_PRICEWHLSL_UNITS
-------- --------------------------------
10011 Boot Beginner’s ski boot 518
1001 150

10012 Ace Ski BootIntermediate ski boot519


1002 200

10013 Pro Ski BootAdvanced ski boot 520


1003 410

10021 Bunny Ski PoleBeginner’s ski pole528


1011 16.25

10022 Ace Ski PoleIntermediate ski pole529


1012 21.95

10023 Pro Ski PoleAdvanced ski pole 530


1013 40.95

20106 Junior Soccer BallJunior soccer ball613


11

20108 World Cup Soccer BallWorld cup soccer ball615


28

20201 World Cup NetWorld cup net 708


123

......................................................................................................................................................
B-18 Oracle Developer: Build Reports
S_PRODUCT Data
.....................................................................................................................................................

S_PRODUCT Data (continued)

ID NAME SHORT_DESC LONGTEXT_ID


---- ---------------------------------------
IMAGE_IDSUGGESTED_WHLSL_PRICEWHLSL_UNITS
----------------------------------------
20510 Black Hawk Knee pads, pair 1017
Knee Pads 9

20512Black Hawk Elbow pads, pair 1019


Elbow Pads 8

30321 Grand Prix Bicycle Road bicycle828


1291 1669

30326 Himalaya BicycleMountain bicycle833


1296 582

30421 Grand Prix Road bicycle tires927


Bicycle Tires16

30426 Himalaya TiresMountain bicycle tires933


18.25

30433New Air PumpTire pump 940


20

32779 Slaker Water Water bottle 1286


Bottle 7

32861 Safe-T HelmetBicycle helmet 1368


1829 60

40421 Alexeyer ProStraight bar 928


Lifting Bar
1381 65

40422 Pro Curling BarCurling bar 929


1382 50

......................................................................................................................................................
Oracle Developer: Build Reports B-19
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_PRODUCT Data (continued)

ID NAME SHORT_DESC LONGTEXT_ID


---- ---------------------------------------
IMAGE_ID SUGGESTED_WHLSL_PRICEWHLSL_UNITS
-------- --------------------------------
40421 Alexeyer ProStraight bar 928
Lifting Bar
1381 65

40422 Pro Curling BarCurling bar 929


1382 50

41010 Prostar 10 Ten pound weight 517


Pound Weight
8

41020 Prostar 20 Twenty pound weight527


Pound Weight
12

41050 Prostar 50 Fifty pound weight557


Pound Weight
25

41080 Prostar 80 Eighty pound weight587


Pound Weight
35

41100 Prostar 100 One hundred pound 607


Pound Weightweight
45

50169 Major League Baseball 676


Baseball
1119 4.29

......................................................................................................................................................
B-20 Oracle Developer: Build Reports
S_PRODUCT Data
.....................................................................................................................................................

S_PRODUCT Data (continued)

ID NAME SHORT_DESC LONGTEXT_ID


---- -----------------------------------------
IMAGE_IDSUGGESTED_WHLSL_PRICEWHLSL_UNITS
----------------------------------------
50273Chapman HelmetBatting helmet 780
1223 22.89

50417 Griffey GloveOutfielder’s glove 924


1367 80

50418 Alomar GloveInfielder’s glove 925


1368 75

50419 Steinbach GloveCatcher’s glove 926


1369 80

50530Cabrera Bat Thirty inch bat 1037


1480 45

50532 Puckett Bat Thirty-two inch bat 1039


1482 47

50536 Winfield BatThirty-six inch bat 1043


1486 50

Note: This display has been formatted.

......................................................................................................................................................
Oracle Developer: Build Reports B-21
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

S_REGION Description and Data


Column Name Null? Datatype
------------------------------ ----------------
ID NOT NULL NUMBER(7)
NAME NOT NULL VARCHAR2(50)

SQL> SELECT * FROM s_region;

ID NAME
--- --------------------------
1 North America
2 South America
3 Africa / Middle East
4 Asia
5 Europe

......................................................................................................................................................
B-22 Oracle Developer: Build Reports
S_TITLE Description and Data
.....................................................................................................................................................

S_TITLE Description and Data


Column Name Null? Datatype
---------------------------------- ----------------
TITLE NOT NULL VARCHAR2(25)

SQL> SELECT * FROM s_title;

TITLE
------------------------
President
Sales Representative
Stock Clerk
VP, Administration
VP, Finance
VP, Operations
VP, Sales
Warehouse Manager

8 rows selected.

......................................................................................................................................................
Oracle Developer: Build Reports B-23
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

Oracle8 Objects: Types, Tables


emp_type_ObjCol
Name Null? Type
-------------------- ------------- ----------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID DEPT_TYPE
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)

emp_type_RefCol
Name Null? Type
-------------------- ------------- ----------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID REF OF DEPT_TYPE
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)

dept_type
--------------------------------- ----------------
ID NUMBER
NAME VARCHAR2(25)
REGION_ID NUMBER(7)

......................................................................................................................................................
B-24 Oracle Developer: Build Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

Tables

oo_emp_Table_ObjCol
Name Null? Type
-------------------- ------------- ----------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID DEPT_TYPE
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)
ID LAST_NAME FIRST_NAME USERID
--------- --------------------- --------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
-----------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
1Velasquez Carmencvelasqu
03-MAR-90 President
DEPT_TYPE(50, ’Administration’, 1)
2500

2Ngao LaDorislngao
08-MAR-90 1 VP Operations
DEPT_TYPE(41, ’Operations’, 1)
1450

3Nagayama Midorimnagayam
17-JUN-91 1 VP Sales
DEPT_TYPE(31, ’Sales’, 1)
1400

......................................................................................................................................................
Oracle Developer: Build Reports B-25
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- ----------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
4 Quick-To-See Mark mquickto
07-APR-90 1 VP Finance
DEPT_TYPE(10, ’Finance’, 1)
1450

5 Ropeburn Audry aropebur


04-MAR-90 1 VP Administration
DEPT_TYPE(50, ’Administration’, 1)
1550

6 Urguhart Molly murguhar


18-JAN-91 2 Warehouse Manager
DEPT_TYPE(41, ’Operations’, 1)
1200

7 Menchu Roberta rmenchu


14-MAY-90 2 Warehouse Manager
DEPT_TYPE(42, ’Operations’, 2)
1250

8 Biri Ben bbiri


07-APR-90 2 Warehouse Manager
DEPT_TYPE(43, ’Operations’, 3)
1100

9 Catchpole Antoinette acatchpo


09-FEB-92 2 Warehouse Manager
DEPT_TYPE(44, ’Operations’, 4)
1300

......................................................................................................................................................
B-26 Oracle Developer: Build Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- ------------------------------ --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
10 Havel Marta mhavel
27-FEB-91 2 Warehouse Manager
DEPT_TYPE(45, ’Operations’, 5)
1307

11 Magee Colin cmagee


14-MAY-90 3 Sales Representative
DEPT_TYPE(31, ’Sales’, 1)
1400 10

12 Giljum Henry hgiljum


18-JAN-92 3 Sales Representative
DEPT_TYPE(32, ’Sales’, 2)
1490 13

13 Sedeghi Yasmin ysedeghi


18-FEB-91 3 Sales Representative
DEPT_TYPE(33, ’Sales’, 3)
1515 10

14 Nguyen Mai mnguyen


22-JAN-92 3 Sales Representative
DEPT_TYPE(34, ’Sales’, 4)
1525 15

15 Dumas Andre adumas


09-OCT-91 3 Sales Representative
DEPT_TYPE(35, ’Sales’, 5)
145018

......................................................................................................................................................
Oracle Developer: Build Reports B-27
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- -------------- --------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
16 Maduro Elena emaduro
07-FEB-92 6 Stock Clerk
DEPT_TYPE(41, ’Operations’, 1)
1400

17 Smith George gsmith


08-MAR-90 6 Stock Clerk
DEPT_TYPE(41, ’Operations’, 1)
940

18 Nozaki Akira anozaki


09-FEB-91 7 Stock Clerk
DEPT_TYPE(42, ’Operations’, 2)
1200

19 Patel Vikram vpatel


06-AUG-91 7 Stock Clerk
DEPT_TYPE(42, ’Operations’, 2)
795

20 Newman Chad cnewman


21-JUL-91 8 Stock Clerk
DEPT_TYPE(43, ’Operations’, 3)
750

21 Markarian Alexander amarkari


26-MAY-91 8 Stock Clerk
DEPT_TYPE(43, ’Operations’, 3)
850

......................................................................................................................................................
B-28 Oracle Developer: Build Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- ------------------------------ --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
22 Chang Eddie echang
30-NOV-90 9 Stock Clerk
DEPT_TYPE(44, ’Operations’, 4)
800

23 Patel Radha rpatel


17-OCT-90 9 Stock Clerk
DEPT_TYPE(34, ’Sales’, 4)
795

24 Dancs Bela bdancs


17-MAR-91 10 Stock Clerk
DEPT_TYPE(45, ’Operations’, 5)
860

25 Schwartz Sylvie sschwart


09-MAY-91 10 Stock Clerk
DEPT_TYPE(45, ’Operations’, 5)
1100

oo_emp_Table_RefCol
Name Null? Type
------------------------------ ----------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID REF OF DEPT_TYPE
SALARY NUMBER(11,2)
COMMISSION_PCTNUMBER(4,2)
......................................................................................................................................................
Oracle Developer: Build Reports B-29
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
1 Velasquez Carmen cvelasqu
03-MAR-90 President
0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
2500

2 Ngao LaDoris lngao


08-MAR-90 1 VP Operations
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1450

3 Nagayama Midori mnagayam


17-JUN-91 1 VP Sales
0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1400

4 Quick-To-See Mark mquickto


07-APR-90 1 VP Finance
0000220208447F54A9ED59676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1450

5 Ropeburn Audry aropebur


04-MAR-90 1 VP Administration
0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1550

......................................................................................................................................................
B-30 Oracle Developer: Build Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- ------------------ --------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
6 Urguhart Molly murguhar
18-JAN-91 2 Warehouse Manager
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1200

9 Catchpole Antoinette acatchpo


09-FEB-92 2 Warehouse Manager
0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1300

10 Havel Marta mhavel


27-FEB-91 2 Warehouse Manager
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1307

11 Magee Colin cmagee


14-MAY-90 3 Sales Representative
0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1400 10

13 Sedeghi Yasmin ysedeghi


18-FEB-91 3 Sales Representative
0000220208447F54A9ED5C676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1515 10

......................................................................................................................................................
Oracle Developer: Build Reports B-31
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- ------------------ --------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
14 Nguyen Mai mnguyen
22-JAN-92 3 Sales Representative
0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1525 15

15 Dumas Andre adumas


09-OCT-91 3 Sales Representative
0000220208447F54A9ED5E676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1450 18

16 Maduro Elena emaduro


07-FEB-92 6 Stock Clerk
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1400

17 Smith George gsmith


08-MAR-90 6 Stock Clerk
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
940

18 Nozaki Akira anozaki


09-FEB-91 7 Stock Clerk
0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1200

......................................................................................................................................................
B-32 Oracle Developer: Build Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
19 Patel Vikram vpatel
06-AUG-91 7 Stock Clerk
0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
795

20 Newman Chad cnewman


21-JUL-91 8 Stock Clerk
0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
750

21 Markarian Alexander amarkari


26-MAY-91 8 Stock Clerk
0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
850

22 Chang Eddie echang


30-NOV-90 9 Stock Clerk
0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
800

23 Patel Radha rpatel


17-OCT-90 9 Stock Clerk
0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
795

......................................................................................................................................................
Oracle Developer: Build Reports B-33
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
24 Dancs Bela bdancs
17-MAR-91 10 Stock Clerk
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
860

25 Schwartz Sylvie sschwart


09-MAY-91 10 Stock Clerk
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1100

oo_dept_table
Name Null? Type
-------------------- ------------- ----------------
ID NUMBER
NAME VARCHAR2(25)
REGION_ID NUMBER(7)

ID NAME REGION_ID
-------------------- ------------- ----------------
10 Finance 1
31 Sales 1
32 Sales 2
33 Sales 3
34 Sales 4
35 Sales 5
41 Operations 1
42 Operations 2
43 Operations 3
44 Operations 4
45 Operations 5
50 Administration 1
......................................................................................................................................................
B-34 Oracle Developer: Build Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

rel_emp_Table_Objcol
Name Null? Type
-------------------- ------------- ----------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID DEPT_TYPE
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)

ID LAST_NAME FIRST_NAME USERID


---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
1 Velasquez Carmen cvelasqu
03-MAR-90 President
DEPT_TYPE(50, ’Administration’, 1)
2500

2 Ngao LaDoris lngao


08-MAR-90 1 VP Operations
DEPT_TYPE(41, ’Operations’, 1)
1450

3 Nagayama Midori mnagayam


17-JUN-91 1 VP Sales
DEPT_TYPE(31, ’Sales’, 1)
1400

......................................................................................................................................................
Oracle Developer: Build Reports B-35
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
4 Quick-To-See Mark mquickto
07-APR-90 1 VP Finance
DEPT_TYPE(10, ’Finance’, 1)
1450

5 Ropeburn Audry aropebur


04-MAR-90 1 VP Administration
DEPT_TYPE(50, ’Administration’, 1)
1550

6 Urguhart Molly murguhar


18-JAN-91 2 Warehouse Manager
DEPT_TYPE(41, ’Operations’, 1)
1200

7 Menchu Roberta rmenchu


14-MAY-90 2 Warehouse Manager
DEPT_TYPE(42, ’Operations’, 2)
1250

8 Biri Ben bbiri


07-APR-90 2 Warehouse Manager
DEPT_TYPE(43, ’Operations’, 3)
1100

9 Catchpole Antoinette acatchpo


09-FEB-92 2 Warehouse Manager
DEPT_TYPE(44, ’Operations’, 4)
1300

......................................................................................................................................................
B-36 Oracle Developer: Build Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
10 Havel Marta mhavel
27-FEB-91 2 Warehouse Manager
DEPT_TYPE(45, ’Operations’, 5)
1307

11 Magee Colin cmagee


14-MAY-90 3 Sales Representative
DEPT_TYPE(31, ’Sales’, 1)
1400 10

12 Giljum Henry hgiljum


18-JAN-92 3 Sales Representative
DEPT_TYPE(32, ’Sales’, 2)
1490 13

13 Sedeghi Yasmin ysedeghi


18-FEB-91 3 Sales Representative
DEPT_TYPE(33, ’Sales’, 3)
1515 10

14 Nguyen Mai mnguyen


22-JAN-92 3 Sales Representative
DEPT_TYPE(34, ’Sales’, 4)
1525 15

15 Dumas Andre adumas


09-OCT-91 3 Sales Representative
DEPT_TYPE(35, ’Sales’, 5)
1450 18

......................................................................................................................................................
Oracle Developer: Build Reports B-37
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
16 Maduro Elena emaduro
07-FEB-92 6 Stock Clerk
DEPT_TYPE(41, ’Operations’, 1)
1400

17 Smith George gsmith


08-MAR-90 6 Stock Clerk
DEPT_TYPE(41, ’Operations’, 1)
940

18 Nozaki Akira anozaki


09-FEB-91 7 Stock Clerk
DEPT_TYPE(42, ’Operations’, 2)
1200

19 Patel Vikram vpatel


06-AUG-91 7 Stock Clerk
DEPT_TYPE(42, ’Operations’, 2)
795

20 Newman Chad cnewman


21-JUL-91 8 Stock Clerk
DEPT_TYPE(43, ’Operations’, 3)
750

21 Markarian Alexander amarkari


26-MAY-91 8 Stock Clerk
DEPT_TYPE(43, ’Operations’, 3)
850

......................................................................................................................................................
B-38 Oracle Developer: Build Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
22 Chang Eddie echang
30-NOV-90 9 Stock Clerk
DEPT_TYPE(44, ’Operations’, 4)
800

23 Patel Radha rpatel


17-OCT-90 9 Stock Clerk
DEPT_TYPE(34, ’Sales’, 4)
795

24 Dancs Bela bdancs


17-MAR-91 10 Stock Clerk
DEPT_TYPE(45, ’Operations’, 5)
860

25 Schwartz Sylvie sschwart


09-MAY-91 10 Stock Clerk
DEPT_TYPE(45, ’Operations’, 5)
1100

rel_emp_Table_RefCol
Name Null? Type
-------------------- ------------- ----------------
ID NUMBER(7)
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
USERID VARCHAR2(8)
START_DATE DATE
MANAGER_ID NUMBER(7)
TITLE VARCHAR2(25)
DEPT_ID REF OF DEPT_TYPE
SALARY NUMBER(11,2)
COMMISSION_PCT NUMBER(4,2)
......................................................................................................................................................
Oracle Developer: Build Reports B-39
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
1 Velasquez Carmen cvelasqu
03-MAR-90 President
0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
2500

2 Ngao LaDoris lngao


08-MAR-90 1 VP Operations
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1450

3 Nagayama Midori mnagayam


17-JUN-91 1 VP Sales
0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1400

4 Quick-To-See Mark mquickto


07-APR-90 1 VP Finance
0000220208447F54A9ED59676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1450

5 Ropeburn Audry aropebur


04-MAR-90 1 VP Administration
0000220208447F54A9ED64676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1550

......................................................................................................................................................
B-40 Oracle Developer: Build Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
6 Urguhart Molly murguhar
18-JAN-91 2 Warehouse Manager
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1200

9 Catchpole Antoinette acatchpo


09-FEB-92 2 Warehouse Manager
0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1300

10 Havel Marta mhavel


27-FEB-91 2 Warehouse Manager
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1307

11 Magee Colin cmagee


14-MAY-90 3 Sales Representative
0000220208447F54A9ED5A676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1400 10

13 Sedeghi Yasmin ysedeghi


18-FEB-91 3 Sales Representative
0000220208447F54A9ED5C676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1515 10

......................................................................................................................................................
Oracle Developer: Build Reports B-41
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
14 Nguyen Mai mnguyen
22-JAN-92 3 Sales Representative
0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1525 15

15 Dumas Andre adumas


09-OCT-91 3 Sales Representative
0000220208447F54A9ED5E676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1450 18

16 Maduro Elena emaduro


07-FEB-92 6 Stock Clerk
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1400

17 Smith George gsmith


08-MAR-90 6 Stock Clerk
0000220208447F54A9ED5F676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
940

18 Nozaki Akira anozaki


09-FEB-91 7 Stock Clerk
0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1200

......................................................................................................................................................
B-42 Oracle Developer: Build Reports
Oracle8 Objects: Types, Tables
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
19 Patel Vikram vpatel
06-AUG-91 7 Stock Clerk
0000220208447F54A9ED60676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
795

20 Newman Chad cnewman


21-JUL-91 8 Stock Clerk
0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
750

21 Markarian Alexander amarkari


26-MAY-91 8 Stock Clerk
0000220208447F54A9ED61676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
850

22 Chang Eddie echang


30-NOV-90 9 Stock Clerk
0000220208447F54A9ED62676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
800

23 Patel Radha rpatel


17-OCT-90 9 Stock Clerk
0000220208447F54A9ED5D676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
795

......................................................................................................................................................
Oracle Developer: Build Reports B-43
Appendix B: Table Descriptions and Data
.....................................................................................................................................................

ID LAST_NAME FIRST_NAME USERID


---------- --------------------------------- --------
START_DAT MANAGER_ID TITLE
--------- ---------- -------------------------
DEPT_ID(ID, NAME, REGION_ID)
------------------------------------------------------------
SALARY COMMISSION_PCT
---------- --------------
24 Dancs Bela bdancs
17-MAR-91 10 Stock Clerk
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
860

25 Schwartz Sylvie sschwart


09-MAY-91 10 Stock Clerk
0000220208447F54A9ED63676AE03408002072C15B447F54A9ED55676AE03408
002072C15B
1100

......................................................................................................................................................
B-44 Oracle Developer: Build Reports
C
................................

Frequently Asked
Questions
Appendix C: Frequently Asked Questions
......................................................................................................................................................

Frequently Asked Questions


Contents
1 How do I set up and run my reports on a remote server?
2 How can the Report Builder Background Engine be shut down
programmatically from another Oracle Developer application?
3 How do I pass parameters with spaces from the command line or from the Form
Builder built-in RUN_REPORT_OBJECT or RUN_PRODUCT?
4 How do I print a report to an ASCII file with no page breaks or control
characters?
5 How do I create a report containing barcodes in Report Builder?
6 How do I print a character mode report in landscape orientation?
7 How do I send report output to a fax?
8 How do I suppress rows or columns in a Matrix report?
9 How can I print to the second printer tray using Report Builder?
10 What Registry parameter is used in Windows to redirect where temporary files
are created?
11 How do I automatically delete temporary files created when running Report
Builder?
12 Is there any way to programmatically disable the Print button in the run-time
Previewer?

......................................................................................................................................................
C-2 Oracle Developer: Build Reports
Frequently Asked Questions and Answers
......................................................................................................................................................

Frequently Asked Questions and Answers


Accessing Reference Material
The reference numbers given in these answers are the index numbers that enable
you to search for a document in Metalink if you are a member of the Oracle Metals
Program; that is, support levels Bronze, Silver, and Gold. If you do not currently
have one of these metal support services, you can call your sales representative to
upgrade your support service level.
You can use these numbers for an exact match, or you can search on full words
pertaining to the problem you are having, such as BOILERPLATE.
From http://support.oracle.com/metalink choose the TOOLS option and
then choose Oracle Developer reports. From there choose Top Product Articles and
enter the text for your search. Click the Advanced button and choose ConText
Syntax before starting the search.
Oracle allows access to published bulletins only from Metalink. If you do not find
the topic you need, call the support center for help. Material is constantly being
added to this site in an effort to give customers fast access to the information they
need.
Note: These documents can also be obtained by calling the customer support
hotline.
1 How do I set up and run my reports on a remote server?

Answer The Multitiered Reports Server, which is part of Oracle Developer


Release 6.0, enables you to run reports on a remote application server. When used in
conjunction with the Reports Web CGI or Web Cartridge, it also enables you to run
reports from a Web browser using standard URL syntax. The server can be installed
on Windows NT, Windows95, or UNIX. It handles client requests to run reports by
entering all requests into a job queue.

For Further Information


• Oracle Developer R6.0 Documentation: Online Manuals
• Oracle Developer: Guidelines for Building Applications
• 2: Deploying Applications on the Web
• 2.2.3: Configuring Reports for the Web
• 2.2.3.1: Setting up the Reports Server

......................................................................................................................................................
Oracle Developer: Build Reports C-3
Appendix C: Frequently Asked Questions
......................................................................................................................................................

2 How can the Report Builder Background Engine be shut down


programmatically from another Oracle Developer application?

Answer In your Form application, use ORACLE_SHUTDOWN = Yes as a


parameter in a parameter list that you pass to the Form Builder built-in,
RUN_PRODUCT.
The parameter value, Yes, must have initial capitals.

References
<PrSol:2067466.6>
3 How do I pass parameters with spaces from command line or from the
Form Builder built-ins RUN_REPORT_OBJECT or RUN_PRODUCT?

Answer
• Use a CMDFILE for passing parameters with spaces from the command line.
• Use extra quotes to delimit values to pass parameter values with spaces when
using RUN_REPORT_OBJECT or RUN_PRODUCT.

References
<PrSol:2056652.6>
4 How do I print a report to an ASCII file with no page breaks or control
characters?

Answer Remove "CONTROL(L)" from the "AFTER PAGE{S} CONTROL(L)"


line in dflt.prt or use DESFORMAT=no_ff (A no_ff.prt printer definition file
is supplied as part of the Report Builder installation in the
<oracle_home>\report60\printers directory.)

References
<PrSol:2058834.6>

......................................................................................................................................................
C-4 Oracle Developer: Build Reports
Frequently Asked Questions and Answers
......................................................................................................................................................

5 How do I create a report containing barcodes in Report Builder?

Answer In Windows, use the barcode font supplied as part of the Report Builder
installation, in the <oracle_home>\tools\devdem60\bin directory, or any third-
party barcode font.
Alternatively, you can use Oracle Developer Graphics Builder.

References
<PrSol:2059321.6>
6 How do I print a character mode report in landscape orientation?

Answer Manually edit escape sequences into a .prt file.

References
<Note:34318.1> Landscape Printing in Reports on Windows
7 How do I send report output to a fax?

Answer Install a third-party software—for example Winfax—and make that a


printer.
In order to programmatically fax a report without any user interaction through
Microsoft Exchange Fax driver, look up bulletin BUL 13000147.6 (CR 159472).

References
<PrSol:2083424.6>

......................................................................................................................................................
Oracle Developer: Build Reports C-5
Appendix C: Frequently Asked Questions
......................................................................................................................................................

8 How do I suppress blank rows or columns in a Matrix report?

Answer In Release 2.0 or earlier, create a summary column in the cross product
group to count the number of cells that hold a NOT NULL value. Use a format
trigger to suppress the row or column if this value is zero.
In Release 6, a nested matrix style creates a “non-sparse” matrix by default, which
means that it suppresses all blank rows or columns.

References
<PrSol:2065884.6>
9 How can I print to the second printer tray using Report Builder?

Answer Use a Before Report, Between Pages, or other format trigger to switch to
different printer trays as your report formats. You can determine the names of the
printer trays defined for your printer in the Page Setup dialog box.
In Release 2.0, use SRW.SET_ATTR (PRINTER_INTRAY attribute) to set the
printer tray as desired.
In Release 6, use SRW.SET_PRINTER_TRAY, which provides an easier syntax
similar to Form Builder.

References
• <PrSol:2063840.4>
• <Note:40507.1>

......................................................................................................................................................
C-6 Oracle Developer: Build Reports
Frequently Asked Questions and Answers
......................................................................................................................................................

10 What Registry parameter is used in Windows to redirect where temporary


files are created?

Answer Report Builder uses the REPORTS60_TMP parameter in the Registry. If


this is not set, then it uses the working directory instead.
11 How do I automatically delete temporary files created when running
reports using Reports Runtime?

Answer Running a report to a file from the run-time module does not delete the
idx files. The idx files must be deleted manually. This is a documented bug.

References
<BUG:332572>
12 Is there any way to programmatically disable the Print button in the run-
time Previewer?

Answer Include the DISABLEPRINT=YES argument in your command line.


Release 2.1 also provides a DISABLEMAIL argument.

......................................................................................................................................................
Oracle Developer: Build Reports C-7
Appendix C: Frequently Asked Questions
......................................................................................................................................................

......................................................................................................................................................
C-8 Oracle Developer: Build Reports
D
................................

Oracle Rdb Overview


Appendix D: Oracle Rdb Overview
......................................................................................................................................................

What Is Oracle Rdb?


Oracle Rdb is a multiuser relational database management system designed and
developed by Oracle Corporation for high availability, high performance, and ease of
use in large-scale, mission-critical applications. It includes a full set of utilities for
database maintenance and an industry-standard version of SQL that allows you to
easily create applications and maintain your Oracle Rdb databases.
Oracle Rdb is currently running on over 45 thousand servers at more than 15 thousand
sites worldwide. It is used in many large online transaction processing (OLTP) systems
and its customer list comprises some of the worlds’ leading corporations. Oracle
continues to enhance the functionality of Rdb by adding new features and
strengthening integration with other Oracle technology and tools.

Supported Platforms
Oracle Rdb is available on the following computing platforms:
• OpenVMS VAX
• OpenVMS Alpha
• Windows NT Intel and Alpha

Oracle Rdb Features


These are some of the features that Oracle Rdb offers:
• Disaster tolerance
The Hot Standby option is ideal where very high performance and continuous
(7 by 365) availability is essential. It provides disaster tolerance across
geographically dispersed systems using the existing network with no change in
applications or material increment in system overhead. The Hot Standby system
can be accessed simultaneously for read-only transactions.
• High performance
Rdb is optimized to meet enterprise OLTP requirements for the highest levels of
performance on OpenVMS Alpha and VAX. Features include full support for
64-bit Very Large Memory on OpenVMS Alpha, mixed-clusters, patented Record
Caching; pinning tables in memory for rapid access, a patented Dynamic Query
Optimizer, and Query Outlines for repeatable query performance.
• Ease of management
Rdb provides comprehensive, simple management of Rdb databases. Default
database settings provide great performance for Rdb out of the box. The Enterprise
Manager DBAPack for Rdb provides a complete set of management tools for Rdb
that can be run from the Oracle Enterprise Manager console. The TRACE/Expert
option provides performance monitoring and expert database design for Rdb. Rdb8
integration with Oracle Enterprise Manager provides common graphical interfaces
to manage Rdb and Oracle RDBMS from the same Windows console.

......................................................................................................................................................
D-2 Oracle Developer: Build Reports
What Is Oracle Rdb?
......................................................................................................................................................

Oracle Rdb Features (continued)


• Support for Windows NT Intel and Alpha
Compaq customers can extend their OpenVMS environment to include NT and
run Rdb applications on commodity Intel platforms. Rdb8 on NT is a native, multi-
threaded, complete implementation of Rdb.
• Integration with other Oracle technologies
Rdb customers can leverage their investment in Rdb by enhancing existing
applications and developing new ones with the latest Oracle tools for Web and
client-server application development, and powerful business intelligence analysis.
Customers can make a single investment in products and training that is
completely portable across Rdb and Oracle RDBMS. Rdb supports Oracle
Application Server, Oracle Developer, Oracle Designer, Oracle Discoverer, and
Oracle Express Server.
• Support for SQL*Net for Rdb
This enables integration with the Oracle technologies listed above. Customers and
application partners can use standard Oracle APIs to build applications that run on
Rdb and Oracle RDBMS. Data sharing between Rdb and Oracle RDBMS is
enabled without the use of gateways. Rdb includes support for the Oracle Call
Level Interface (OCI), Oracle network protocols, and DB Links.

Other Information

Oracle Rdb Education Oracle Education offers a comprehensive series of Oracle


Rdb courses. The course titles include:
• Introduction to Rdb: Technical Overview and SQL Language
• Rdb for the Database Administrator
• Rdb for the Database Designer
• Rdb 3GL Programming
• Rdb Performance and Tuning
• Rdb Internals
To receive the Oracle Education U.S. schedule and catalog, which contains complete
course descriptions, pricing, and enrollment information, call 1.800.633.0575 within
the continental U.S. or 650.633.5019 from outside the U.S. For international course
information, contact the Oracle site nearest to you. You can also get Oracle Education
information and order catalogs from the following website:
http://www.oracle.com.

......................................................................................................................................................
Oracle Developer: Build Reports D-3
Appendix D: Oracle Rdb Overview
......................................................................................................................................................

Other Information (continued)

Oracle Rdb Product Information The Rdb website is a resource for finding out the
latest news on the product and its features. Look here for information such as:
• New product releases
• Product interoperability information
• How customers are using Oracle Rdb
• Calendar of product-related events
To access the website, go to the following URL: http://www.oracle.com/rdb

Oracle Rdb Demonstration CD-ROM To receive a free Oracle Rdb product


demonstration CD-ROM, send an e-mail including your name, address, and company
to: infordb@us.oracle.com.
Specify that you’d like to receive the free Oracle Rdb CD-ROM.

......................................................................................................................................................
D-4 Oracle Developer: Build Reports
E
................................

Introduction to Query
Builder
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Query Builder Features

• Easy-to-use data access tool


• Point-and-click graphical user interface
• Distributed data access
• Powerful query building

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
E-2 Oracle Developer: Build Reports
What Is Query Builder?
......................................................................................................................................................

What Is Query Builder?


Easy-to-Use Data Access Tool
Query Builder is an easy-to-use data access tool. It provides a logical and intuitive
means to access information stored in networked, distributed databases for analysis
and reporting.

Point-and-Click Graphical User Interface


Query Builder enables you to become productive quickly because its graphical user
interface works like your other applications. A toolbar enables you to perform
common operations quickly.

Distributed Data Access


Query Builder represents all database objects (tables, views, and so on) as graphical
datasources, which look and work exactly the same way regardless of which database
or account the data came from.
• Performing distributed queries on complex, enterprise-wide databases is
no more difficult than querying a single database.
• Locating database objects is easy because Query Builder uses a single
hierarchical directory that lists all accessible data in your account, in
other accounts, and in other databases.

......................................................................................................................................................
Oracle Developer: Build Reports E-3
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Query Builder Features

• Easy-to-use data access tool


• Point-and-click graphical user interface
• Distributed data access
• Powerful query building

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
E-4 Oracle Developer: Build Reports
What Is Query Builder?
......................................................................................................................................................

Powerful Query Building


Query Builder is designed for professionals who do not have a computer programming
or database background. However, because of its powerful query features and its
support of Structured Query Language (SQL) statements, experienced database users
and programmers will find that Query Builder serves many of their needs as well.
• Graphical representation of tables and their relationships enables you to
see the structure of your data.
• You can build queries by clicking on the columns that you want to
retrieve from the database. The browser generates the necessary SQL
statements behind the scenes.
• You can specify exactly which rows to retrieve from the database by
using conditions, which consist of any valid SQL expression that
evaluates to true or false.
• You can combine and nest conditions graphically using logical
operators. You can disable conditions temporarily for what-if analysis.
Note: Query Builder as a tool in itself also includes WYSIWYG formatting and
reporting capabilities. This lesson describes Query Builder as part of tools like Report
Builder.

......................................................................................................................................................
Oracle Developer: Build Reports E-5
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Query Builder Window

2 3

Copyright  Oracle Corporation, 1999. All rights reserved.

1 Toolbar
2 Conditions panel
3 Datasource panel

......................................................................................................................................................
E-6 Oracle Developer: Build Reports
The Query Builder Window
......................................................................................................................................................

The Query Builder Window


The Query Builder graphical user interface consists of one window, the Query
window, where you build your queries.

Query Window Panels


The Query window is divided into two panels:
• The Conditions panel where you specify conditions to refine your
queries
• The Datasource panel where you display and select tables and columns
for a query

Toolbar
The toolbar enables you to issue commands with a click of the mouse. You can create
conditions, add new data sources, or define new columns.

......................................................................................................................................................
Oracle Developer: Build Reports E-7
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Building a New Query

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
E-8 Oracle Developer: Build Reports
Building a New Query
......................................................................................................................................................

Building a New Query


To build a query you must select the tables you want to include and the columns you
want to retrieve.

How to Include a Table


1 Choose Select Data Tables from the toolbar.
The Select Data Tables dialog box appears.
Note: When you open Query Builder to create a new query, the Data Table dialog
box is open by default.
2 Select the table name and then choose Include, or simply double-click
the desired table name.
The selected table appears in the Query window.
3 Choose Close to close the dialog box.
You can at any time include additional tables in the query by following these steps.

How to Delete a Table


1 Select the datasource in the Query window.
2 Choose Clear from the toolbar or press Delete.

......................................................................................................................................................
Oracle Developer: Build Reports E-9
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Data Source Components

1 5

2
6
3
7

4 8

Copyright  Oracle Corporation, 1999. All rights reserved.

1 Datasource name 5 Object type


2 Primary key 6 Column datatype
3 Column name 7 Recursive relationship icon
4 Foreign key 8 Comments icon

......................................................................................................................................................
E-10 Oracle Developer: Build Reports
Datasource Components
......................................................................................................................................................

Datasource Components
Tables
A table that has been included in a query is referred to as a datasource. It is displayed
as a rectangular graphic in the Datasource panel of the Query window. The top part of
the rectangle contains the table name and an icon representing its type.

Type Description
Table Stores data in the database.
View Acts like a table when you execute a query, but is really a pointer to either a
subset of a table, a combination of tables, or a join of two or more tables.
Synonym Another name for an object. Sometimes table names can be rather cryptic,
such as emp_em_con_tbl. You can create a synonym that simply calls this
table Contracts.
Alias Query Builder uses an alias name for a table when the table is used more
than once, mostly with self-joins (you can also rename a table).

Columns
The body of the rectangle contains column names listed vertically. To the right of the
column name is an icon representing the datatype.
Columns also provide additional information.
• Primary keys are displayed in bold.
• Foreign keys are displayed in italics.
• Recursive relationships are indicated by a self-relationship icon.

......................................................................................................................................................
Oracle Developer: Build Reports E-11
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Refining a Query

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
E-12 Oracle Developer: Build Reports
Refining a Query
......................................................................................................................................................

Refining a Query
Adding Columns to a Query
There are several methods of adding columns to a query:
• Use the check box to the right of the column name
• Double-click the column name
To include all columns from any single table, double-click the table heading.

Removing Columns to a Query


There are several methods of removing columns to a query:
• Clear the check box to the right of the column name
• Double-click the column name
To remove all columns from any single table, double-click the table heading.

Changing Column Position in a Query


By default, Query Builder places columns in the order in which you select them. You
can resequence them by selecting the Column Sequence tool.
The Column Sequence dialog box appears. Column names are shown in the Displayed
Columns list in order of their appearance in the query. Drag any column to a new
postion.
Note: You can also use the Column Sequence dialog box to add columns to or remove
them from a query.

......................................................................................................................................................
Oracle Developer: Build Reports E-13
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Sorting Data

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
E-14 Oracle Developer: Build Reports
Refining a Query
......................................................................................................................................................

Sorting Data
By default a query returns the data in no specific order. To sort the data, you must add
an ORDER BY clause to the query.

How to Add an ORDER BY Clause to a Query


1 Select the Sort tool. The Sort dialog box appears.
2 Select the column you want to sort from the Available Columns list.
3 Choose Copy.
Query Builder adds the column to the Sorted Columns list and places an up arrow
in the list box to indicate the default sort ascending order.
Note: You can sort by more than one column. Query Builder sorts according to the
order in which columns appear in the Sorted Columns list.
4 You can change the sorting order by selecting the column name in the
Sorted Columns list and selecting the desired option button.
5 Choose OK to close the dialog box.

......................................................................................................................................................
Oracle Developer: Build Reports E-15
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Viewing and Saving Queries

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
E-16 Oracle Developer: Build Reports
Viewing and Saving Queries
......................................................................................................................................................

Viewing and Saving Queries


Viewing a Query
Choose the Show SQL tool to view the query text that Query Builder will create.

How to Save a Query


You can save your query as a SQL statement to the file system.
1 Select the Save tool from the toolbar.
The Save As dialog box appears.
2 Enter a file name.
Note: If you do not enter a file extension, Query Builder automatically
appends the .SQL file extension.
3 Select a destination.
4 Choose OK.

......................................................................................................................................................
Oracle Developer: Build Reports E-17
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Including Additional Tables

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
E-18 Oracle Developer: Build Reports
Including Additional Tables
......................................................................................................................................................

Including Additional Tables


Often, all of the data needed to create a desired report cannot be found in a single
table. With Query Builder you can include multiple tables in a single query.
Remember that you can see the names of all the tables in your account by choosing the
Select Data Tables tool. This brings up the Select Data Tables dialog box. You can also
use this dialog box to show only certain types of data sources as well as data sources in
other accounts and databases.

How to Find Tables in Other Accounts


If you do not find the table you are looking for in the Select Data Tables list box in
your own account, you can search other accounts.
1 Open the pop-up menu to display the name of the current database and
the option databases.
2 Select the current database name.
The list box displays a list of accounts that contain tables you can access.
3 Select the name of the account in the list and then choose Open, or
simply double-click the account name. This opens the account and
displays a list of tables in the account.
4 Follow the normal procedure for including tables in the Query window.

How to Find Tables in Other Databases


If you do not find the table you are looking for in the Select Data Tables list box in
your own account, you can search other databases.
1 Open the pop-up menu to display the name of the current database and
the option databases.
2 Select databases.
The list box displays a list of databases you can access.
3 Select the name of the database in the list and then choose Open, or
simply double-click the account name.
4 Follow the normal procedure for including tables in the Query window.

......................................................................................................................................................
Oracle Developer: Build Reports E-19
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Viewing Comments

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
E-20 Oracle Developer: Build Reports
Including Additional Tables
......................................................................................................................................................

How to View Comments


Sometimes, details about the kind of data stored in the database are not reflected by the
table or column names. This can often make it difficult to decide which objects to
include in your query. Query Builder features the Get Info dialog box to provide this
kind of information for tables and columns.
To open the dialog box, follow these steps:
1 In the Datasource panel, select the table or column name.
2 Select the Get Info tool.
Alternatively, you can double-click the Comment icon in each table or column in the
Datasources panel.

......................................................................................................................................................
Oracle Developer: Build Reports E-21
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Including Related Tables

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
E-22 Oracle Developer: Build Reports
Relationships
......................................................................................................................................................

Relationships
To combine data from multiple tables into one query, Query Builder enables you to
search for relationships between tables and to create user-defined relationships if they
do not exist. Additionally, you can activate or deactivate relationships to suit your
needs.

How to Find and Include Related Tables


1 Select the table in the Datasource panel.
2 Select the Select Related Tables tool.
A list of tables that have relationships defined with the selected table
appears.
3 Select the table name and choose Include, or simply double-click the
table name.
The selected table appears in the Datasource panel. Relationships
between the tables are identified by relationship lines, drawn from the
primary keys in one table to the foreign keys in another.
4 Choose Close to close the dialog box.
Once you have included the table, you can retrieve its columns.
Note: When you select a foreign key column before selecting related tables, only the
table to which the foreign key refers appears in the Select Related Tables dialog box.

......................................................................................................................................................
Oracle Developer: Build Reports E-23
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Creating A User-Defined
Relationship

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
E-24 Oracle Developer: Build Reports
Relationships
......................................................................................................................................................

Creating A User-Defined Relationship


When you create a user-defined relationship, Query Builder draws a relationship line
connecting the related columns.

How to Create a Relationship


1 Select the Set Table Relationship tool.
The Set Relationship dialog box appears.
2 Enter the foreign key (A->) and primary key (B->) column names.
3 Type the complete table and column names (separate the table name
from its column name with a period).
4 Choose OK to close the dialog box.

How to Create a Relationship (Optional Method)


1 Select the column that you want to relate (foreign key).
2 While holding down the mouse button, drag the cursor to the related
column in the second table (the primary key).
You are drawing a relationship line as you do so.
3 Once the target column is selected, release the mouse button to anchor
the relationship line.

......................................................................................................................................................
Oracle Developer: Build Reports E-25
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Unmatched Rows

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
E-26 Oracle Developer: Build Reports
Relationships
......................................................................................................................................................

Retrieving Unmatched Rows


Query Builder lets you choose whether to retrieve any unmatched rows when you are
using a relationship in a query. An unmatched row occurs when the relationship
connects tables where there are values on one side that have no corresponding values
on the other side.
There are three types of relationships that you can choose from:
• Display records from table A not found in table B
• Display records from table B not found in table A
• Suppress any mismatched records (default)

How to Create an Unmatched Relationship


1 Click on the relationship line that connects the tables.
Both the column names and the relationship line should be selected.
2 Select the Set Table Relationship tool from the toolbar.
The Set Relationship dialog box appears.
3 Choose one of the three relationship option buttons.
4 Choose OK.
An unmatched relationship icon is placed on the relationship line next to
the column that returns unmatched rows.

......................................................................................................................................................
Oracle Developer: Build Reports E-27
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Conditions

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
E-28 Oracle Developer: Build Reports
Selecting Rows with Conditions
......................................................................................................................................................

Selecting Rows with Conditions


The Conditions Panel
The Query window contains two independently scrollable panels, the Conditions panel
and the Datasource panel. The Datasource panel is where you include tables and
columns. The Conditions panel is where you apply conditions. You enter conditions
into the Condition field of the panel.

How to Add Conditions to a Query


1 Activate the Conditions field.
2 Enter the text that describes the condition.
Type the conditions directly into the Condition field.
Or
Click in the columns in the Datasource panel and enter the rest of the
condition.
Or
Select columns and functions, using the appropriate tools.
Note: Character and date values must be enclosed in single quotes.
3 Close and validate the condition.
Note: If a column is used in a condition but it is not displayed in the
results window, a gray check mark appears to the left of the column
name in the datasource in the Query Window.

Closing and Validating the Condition


Query Builder automatically validates the condition when you close the Condition
field.
You can close the Condition field in the following ways:
• Press [Return].
• Click in the Conditions panel outside the Condition field.
• Choose Accept from the toolbar.

The Toolbar
The logical operators and the Accept and Cancel tools in the toolbar are active
whenever the Condition field is active. You can insert an operator from the Toolbar
into the condition by clicking on it.

......................................................................................................................................................
Oracle Developer: Build Reports E-29
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Operators
Arithmetic
• Perform calculations on numeric and date
columns
• Examples: +, -, x, /
Logical
• Combine conditions
• Examples: AND, OR, NOT
Comparison
• Compare one expression with another
• Examples: =, <>, <, IN, IS NULL,
BETWEEN ... AND
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
E-30 Oracle Developer: Build Reports
Operators
......................................................................................................................................................

Operators
An operator is a character or reserved word that is used to perform some operation in
Query Builder, such as the + operator, which performs addition. Query Builder uses
several types of operators.

Arithmetic Operators
Arithmetic (+, -, x, /) operators are used to perform calculations on numeric and date
columns. In handling calculations, Query Builder first evaluates any multiplication or
division, then evaluates any addition or subtraction.

Logical Operators
Logical operators are used to combine conditions. They include:
• AND Causes the Browser to retrieve only data that meets all conditions
• OR Causes the Browser to retrieve all data that meets at least one of
the conditions
• NOT Used to make a negative condition, such as NOT NULL

Comparison Operators
Comparison operators are used to compare one expression with another, such that the
result will either be true or false. The Browser returns all data for which the result
evaluates true.

Operator Usage
= Equal
<> Not equal
< Less than
<= Less than or equal
> Greater than
>= Greater than or equal
BETWEEN... Between two values
AND...
IN (LIST) Equal to any member of the following list
IS NULL Is a NULL value. A row without a value in one column is said to contain a
NULL value.

......................................................................................................................................................
Oracle Developer: Build Reports E-31
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Multiple Conditions

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
E-32 Oracle Developer: Build Reports
Entering Multiple Conditions
......................................................................................................................................................

Entering Multiple Conditions


There is no limit to the number of conditions you can include in a Browser query.
Multiple conditions are always combined using logical operators. You can add
conditions to any query either before or after execution.

How to Add Conditions


The Conditions panel always displays a blank Condition field at the bottom of the list
of conditions. Use this field to enter multiple conditions.
1 Click in the empty Condition field to activate it.
2 Enter the new condition.
Each time you add a condition, a new blank Condition field is created.
Note: Pressing [Shift-Return] following the entry of each condition is
the fastest way to create multiple conditions, because it moves the cursor
and prompt down one line so that you can enter another condition.
3 Press [Return] to close and validate the condition.

How to Change Logical Operators


By default, Query Builder combines multiple conditions with the AND operator. To
change the logical operator:
1 Select the logical operator in the Conditions panel.
2 Click on a new operator on the toolbar or select one from the Data menu.

How to Create Nested Conditions


Query Builder enables you to combine logical operators to produce complex queries
made up of multiple levels of conditions. These are referred to as nested conditions. To
nest two or more conditions:
1 Build each condition to be included in the nest.
2 While holding down the [Shift] key, click in the box to the left of each
condition to be nested.
3 Select the logical operator to combine the conditions—either AND or
OR.
Query Builder draws a box around the highlighted conditions in the
Conditions panel and combines them with the operator that you
specified.

......................................................................................................................................................
Oracle Developer: Build Reports E-33
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Deactivating a Condition

Copyright  Oracle Corporation, 1998. All rights reserved.

......................................................................................................................................................
E-34 Oracle Developer: Build Reports
Changing Conditions
......................................................................................................................................................

Changing Conditions
If you change your mind about including one or more conditions in your query, you
can delete, deactivate, or edit any of them in the Conditions panel.

How to Delete a Condition


1 Click inside the Condition field to activate it.
2 Select Clear from the toolbar or choose Delete.
The condition is removed from the query.

How to Deactivate a Condition


Query Builder enables you to temporarily deactivate a condition so that you can test
different scenarios without having to recreate the conditions each time.
Double-clicking on the box to the left of the condition or its operator acts as a toggle
switch, alternately turning the condition on and off. Deactivated conditions remain in
the Condition field but appear dimmed.
Additionally, you can turn conditions on and off by using the Data menu:
1 Select the box to the left of the condition or its operator.
Note: Hold down the [Shift] key to select multiple conditions.
2 Double-click in the box to deactivate the condition.

......................................................................................................................................................
Oracle Developer: Build Reports E-35
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Defining Columns Using an


Expression

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
E-36 Oracle Developer: Build Reports
Defining Columns Using an Expression
......................................................................................................................................................

Defining Columns Using an Expression


Besides retrieving columns of data stored in a table, Query Builder enables you to
define new columns that are derived or calculated from the values in another column.

How to Define a Column


When you define a column, it exists only in your query, not in the database.
1 Select the table where you want to define a new column.
2 Select the Define Column tool.
The Defined Column dialog box appears, which displays a list of all
columns currently defined in the query (if any).
3 Click in the Defined Column field to activate it, then enter the name for
your new column.
4 Move your cursor to the Defined As field and enter the formula or
expression that defines your column.
5 Choose Define.
The new column is added to the list of defined columns in the dialog box
and appears in the Datasource panel.
6 Choose OK to close the dialog box.

How to Enter Expressions


You can enter information in the Defined As field in the following ways:
• Type the expression in directly.
• Choose Paste Column.
The Paste Column dialog box appears.
- Select the column from the displayed list.
- Choose OK to paste the column into your expression and return to
the Define Column dialog box.

How to Display and Hide Defined Columns


You display or hide defined columns from a query in exactly the same manner as you
do ordinary columns.

......................................................................................................................................................
Oracle Developer: Build Reports E-37
Appendix E: Introduction to Query Builder
......................................................................................................................................................

Defining Columns Using a


Function

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
E-38 Oracle Developer: Build Reports
Defining Columns Using a Function
......................................................................................................................................................

Defining Columns Using a Function


The Browser also enables you to define columns using a variety of built-in functions
provided by the Oracle Server. You can type a function directly in the Defined As field
of the Define Columns dialog box, or choose Paste Function to select from a list.

What Is a Function?
A function is similar to an operator in that it performs a calculation and returns a
result. Functions consist of a function name followed by parentheses, in which you
indicate the arguments.
An argument is an expression that supplies information for the function to use.
Functions usually include at least one argument, most commonly the name of the
column on which the operation will be performed.

Single-Row Functions
• Return one value for every data row operated on.
• Examples: INITCAP(),SUBSTR(), TRUNC().

Aggregate Functions
• Return a single row based on the input of multiple rows of data.
• Examples: AVG(), COUNT(), SUM().

How to Select a Function


1 Click in the Defined As field to activate it.
2 Choose Paste Function.
The Paste Function dialog box appears.
3 Select or deselect the Show Categories check boxes to view the desired
list of functions.
4 Select the function from the displayed list.
5 Select the Paste Arguments check box (optional).
Note: If this check box is selected, a description or datatype name of the
arguments appropriate for the function is pasted into your expression.
You then replace the description with the actual arguments.
6 Choose OK to paste the function into your expression and return to the
Define Columns dialog box.

......................................................................................................................................................
Oracle Developer: Build Reports E-39
Appendix E: Introduction to Query Builder
......................................................................................................................................................

......................................................................................................................................................
E-40 Oracle Developer: Build Reports
F
................................

Object Features in
Oracle Developer
Appendix F: Object Features in Oracle Developer
......................................................................................................................................................

Objectives
At the end of this lesson, you should be
able to do the following:
• Describe the new Oracle8 scalar
datatypes
• Describe object types and objects
• Describe object tables, object columns,
and object views
• Describe the INSTEAD-OF triggers
• Describe object REFs
• Identify the display of objects in Object
Navigator
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
F-2 Oracle Developer: Build Reports
Overview
......................................................................................................................................................

Overview
Introduction
In this lesson you will review certain object features of Oracle8. This lesson also
explains how these objects are displayed in the Object Navigator.

Objectives
At the end of this lesson, you should be able to do the following:
• Describe the new Oracle8 scalar datatypes
• Describe object types and objects
• Describe object tables, object columns, and object views
• Describe the INSTEAD-OF triggers
• Describe object REFs
• Identify the display of objects in Object Navigator

......................................................................................................................................................
Oracle Developer: Build Reports F-3
Appendix F: Object Features in Oracle Developer
......................................................................................................................................................

New Oracle8 Scalar Datatypes

• NCHAR
• NVARCHAR2
• FLOAT
• NLS types

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
F-4 Oracle Developer: Build Reports
New Oracle8 Datatypes
......................................................................................................................................................

New Oracle8 Datatypes


Scalar Datatypes
• NCHAR stores fixed-length (blank-padded if necessary) NLS character
data. How the data is represented internally depends on the national
character set, which might use a fixed-width encoding such as
US7ASCII or a variable-width encoding such as JA16SJIS.
• NVARCHAR2 stores variable-length NLS character data. How the data
is represented internally depends on the national character set, which
might use a fixed-width encoding such as WE8EBCDIC37C or a
variable-width encoding such as JA16DBCS.
• FLOAT is a subtype of NUMBER. However, you cannot specify a scale
for FLOAT variables. You can only specify a binary precision, which is
the total number of binary digits.
There is no change to the way scalar datatypes are displayed in Oracle Developer. The
new datatypes are automatically converted to existing Oracle Developer item
datatypes.

NLS Types
Oracle8 offers extended NLS (National Language Support) including national
character sets and the datatypes NCHAR and NVARCHAR2, which store NLS data.
With NLS, number and date formats adapt automatically to the language conventions
specified for a user session, so that users around the world can interact with Oracle in
their native languages. NLS is discussed in Oracle8 Server Reference Manual.

......................................................................................................................................................
Oracle Developer: Build Reports F-5
Appendix F: Object Features in Oracle Developer
......................................................................................................................................................

Object Types

Attributes
Ship
ORDER
po_no Cancel
Check custinfo
status line_items
amount

Hold
Methods
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
F-6 Oracle Developer: Build Reports
New Oracle8 Datatypes
......................................................................................................................................................

Object Types
An object type is a user-defined composite datatype. Orcale8 requires enough
knowledge of a user-defined datatype to interact with it. Therefore, in some sense an
object type is similar to a record type, and in some sense it is similar to a package.
An object type must have one or more attributes and can contain methods.

Attributes An object type is similar to a record type in that it is declared to be


composed of one or more subparts that are of predefined datatypes. Record types call
these subparts fields, but object types call these subparts attributes.
Attributes define the object structure.
CREATE TYPE address_type AS OBJECT
(address VARCHAR2(30),
city VARCHAR2(15),
state CHAR(2),
zip CHAR(5));
CREATE TYPE phone_type AS OBJECT
(country NUMBER(2),
area NUMBER(4),
phone NUMBER(9));
Just as the fields of a record type can be of other record types, the attributes of an
object type can be of other object types. Such an object type is called nested.
CREATE TYPE address_and_phone_type AS OBJECT
(address address_type,
phone phone_type);
Object types are like record types in another sense: Both of them must be declared as
types before the actual object or record can be declared.

......................................................................................................................................................
Oracle Developer: Build Reports F-7
Appendix F: Object Features in Oracle Developer
......................................................................................................................................................

Object Types

Attributes
Ship
ORDER
po_no Cancel
Check custinfo
status line_items
amount

Hold
Methods
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
F-8 Oracle Developer: Build Reports
New Oracle8 Datatypes
......................................................................................................................................................

Methods An object type is also similar to a package. Once an object is declared, its
attributes are similar to package variables. And like packages, objects types can
contain procedures and functions. In object types, these subprograms are known as
methods. A method describes the behavior of an object type.
Like packages, object types can be declared in two parts: a specification and a body.
As with package variables, attributes declared in the object type specification are
public and those declared in the body are private. Also as with package subprograms,
all methods are defined in the package body, but only those whose specification
appears in the object type specification are public methods.
Here is an example of an object type:
CREATE TYPE dept_type AS OBJECT
(dept_idNUMBER(2),
dname VARCHAR2(14),
loc VARCHAR2(3),
MEMBER PROCEDURE set_dept_id (d_id NUMBER),
PRAGMA RESTRICT_REFERENCES (set_dept_id,
RNDS,WNDS,RNPS,WNPS),
MEMBER FUNCTION get_dept_id RETURN NUMBER,
PRAGMA RESTRICT_REFERENCES (get_dept_id,
RNDS,WNDS,RNPS,WNPS));
CREATE TYPE BODY dept_type AS
MEMBER PROCEDURE set_dept_id (d_id NUMBER)
IS
BEGIN
dept_id := d_id;
END;
MEMBER FUNCTION get_dept_id
RETURN NUMBER
IS
BEGIN
RETURN (dept_id);
END;
END;

......................................................................................................................................................
Oracle Developer: Build Reports F-9
Appendix F: Object Features in Oracle Developer
......................................................................................................................................................

Object Tables

Object Table Based on Object Type

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
F-10 Oracle Developer: Build Reports
Creating Oracle8 Objects
......................................................................................................................................................

Creating Oracle8 Objects


Introduction
Once you have declared an object type, you can create objects based on the type.

Object Tables
One way to create an object is to create a table whose rows are objects of that object
type.
Here is an example of an object table declaration:
CREATE TABLE o_dept OF dept_type;
SQL and PL/SQL treat object tables very similarly to relational tables, with the
attribute of the object corresponding to the columns of the table. But there are
significant differences. The most important difference is that rows in an object table
are assigned object IDs (OIDs) and can be referenced using a REF type.
Note: REF types are reviewed later.

......................................................................................................................................................
Oracle Developer: Build Reports F-11
Appendix F: Object Features in Oracle Developer
......................................................................................................................................................

Object Columns

Object Column Based on Object Type

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
F-12 Oracle Developer: Build Reports
Creating Oracle8 Objects
......................................................................................................................................................

Object Columns
Another construct that can be based on an object type is an object column in a
relational table. Here is an example of a relational table creation statement with an
object column:
CREATE TABLE o_customer (
custid NUMBER (6) NOT NULL,
name VARCHAR2 (45),
repid NUMBER (4) NOT NULL,
creditlimit NUMBER (9,2),
address address_type,
phone phone_type);
In the object table, the rows of a table are objects. In a relational table with an object
column, the column is an object. The table will usually have standard columns, as well
as one or more object column.
Object columns are not assigned object IDs, and therefore cannot be referenced using
object REF values.
Note: Object REFs are reviewed later in this section.

......................................................................................................................................................
Oracle Developer: Build Reports F-13
Appendix F: Object Features in Oracle Developer
......................................................................................................................................................

Object Views

Object
Object-Oriented relational
View
Application Table

Object Views Based on Object Types

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
F-14 Oracle Developer: Build Reports
Creating Oracle8 Objects
......................................................................................................................................................

Object Views
Often, the most difficult part of adopting a new technology is the conversion process
itself. For example, a large enterprise might have several applications accessing the
same data stored in relational tables. If such an enterprise decided to start using object-
relational technology, they would not convert all of the applications at once. They
would convert the applications one at a time.
That presents a problem. The applications that have been converted need the data
stored as objects, while the applications that have not been converted need the data
stored in relational tables.
This dilemma is addressed by object views. Like all views, an object view transforms
the way a table appears to a user, without changing the actual structure of the table.
Object views make relational tables look like object tables. This allows the developers
to postpone converting the data from relational structures to object-relational
structures until after all of the applications have been converted. During the
conversion process, the object-relational applications can operate against the object
view, while the relational applications can continue to operate against the relational
tables.
Objects accessed through object views are assigned object IDs, and can be referenced
using Object REFs.
Note: Object REFs are reviewed later in this section.
Here is an example of an object view creation statement:
CREATE VIEW emp_view OF emp_type
WITH OBJECT OID (eno)
AS
SELECT e.empno, e.ename, e.sal, e.job
FROM emp e;

......................................................................................................................................................
Oracle Developer: Build Reports F-15
Appendix F: Object Features in Oracle Developer
......................................................................................................................................................

INSTEAD-OF Triggers

DECLARE

BEGIN

EXCEPTION

END;

Non-updatable View INSTEAD-OF Trigger

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
F-16 Oracle Developer: Build Reports
Creating Oracle8 Objects
......................................................................................................................................................

INSTEAD-OF Triggers
INSTEAD-OF triggers provide a transparent way of modifying views that cannot be
modified directly through SQL DML statements (INSERT, UPDATE, and DELETE).
These triggers are called INSTEAD-OF triggers because, unlike other types of
triggers, Oracle fires the trigger instead of executing the triggering statement. The
trigger performs update, insert, or delete operations directly on the underlying tables.
Users write normal INSERT, DELETE, and UPDATE statements against the view and
the INSTEAD-OF trigger works invisibly in the background to make the right actions
take place.
INSTEAD-OF triggers are activated for each row.
Note: Although INSTEAD-OF triggers can be used with any view, they are typically
needed with Object Views.

......................................................................................................................................................
Oracle Developer: Build Reports F-17
Appendix F: Object Features in Oracle Developer
......................................................................................................................................................

References to Objects
OID

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
F-18 Oracle Developer: Build Reports
Referencing Objects
......................................................................................................................................................

Referencing Objects
Introduction
In relational databases, primary key values are used to uniquely identify records. In
object-relational databases, OIDs provide an alternate method.
When a row in an object table or object view is created, it is automatically assigned a
unique identifier called an object ID.

Object REFs
With relational tables, you can associate two records by storing the primary key of one
record in one of the columns (the foreign key column) of another.
In a similar way, you can associate a row in a relational table to an object by storing
the OID of an object in a column of a relational table.
You can also associate two objects by storing the OID of one object in an attribute of
another. The stored copy of the OID then becomes a pointer, or reference (REF), to the
original object.
The attribute or column that holds the OID is of datatype REF.
Note: Object columns are not assigned OIDs and cannot be pointed to by a REF.
Here is an example of a table declaration that includes a column with a REF datatype:
CREATE TABLE o_emp
( empno NUMBER(4) NOT NULL,
ename VARCHAR2(10),
job VARCHAR2(10),
mgr NUMBER(4),
hiredate DATE,
sal NUMBER(7,2),
comm NUMBER(7,2),
dept REF dept_type SCOPE IS o_dept) ;
Note: The REF is scoped here to restrict the reference to a single table, o_dept. The
object itself is not stored in the table, only the OID value for the object.

......................................................................................................................................................
Oracle Developer: Build Reports F-19
Appendix F: Object Features in Oracle Developer
......................................................................................................................................................

Object Types in
Object Navigator

Copyright  Oracle Corporation, 1999. All rights reserved.

Object Type Wizard

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
F-20 Oracle Developer: Build Reports
Displaying Oracle8 Objects in the Object Navigator
......................................................................................................................................................

Displaying Oracle8 Objects in the Object Navigator


The Object Navigator lists declared types in the Database Objects section, along with
tables, views, and other Oracle objects.

Object Types
Both the attributes and the methods are listed under each type. Also, the nested types
within address_and_phone_type are displayed in an indented sublevel.
This convention is used for nested object and object type displays throughout Oracle
Developer.

Oracle8 Type Wizard


Object types can be created using the Oracle8 Type wizard. The wizard allows you to
define the attributes and methods.

......................................................................................................................................................
Oracle Developer: Build Reports F-21
Appendix F: Object Features in Oracle Developer
......................................................................................................................................................

Object Tables in
Object Navigator

Copyright  Oracle Corporation, 1999. All rights reserved.

Object Columns in
Object Navigator

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
F-22 Oracle Developer: Build Reports
Displaying Oracle8 Objects in the Object Navigator
......................................................................................................................................................

Object Tables
Object tables are displayed like relational tables, with the attributes of the object
displayed like columns in a relational table. Also, the object table type name is
displayed in parentheses after the name of the object table.

Object Columns
Object columns are displayed with the object type in parentheses after the column
name, and with the attributes of the type indented underneath the column name.

......................................................................................................................................................
Oracle Developer: Build Reports F-23
Appendix F: Object Features in Oracle Developer
......................................................................................................................................................

Object Views in
Object Navigator

Copyright  Oracle Corporation, 1999. All rights reserved.

INSTEAD-OF Trigger Dialog Box

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
F-24 Oracle Developer: Build Reports
Displaying Oracle8 Objects in the Object Navigator
......................................................................................................................................................

Object Views
Object views are displayed like any other view, except that the object type they are
based on is written in parentheses after the view name.

INSTEAD-OF Triggers
INSTEAD-OF database triggers can now be created through the trigger creation
dialog box, just like any other database trigger.
INSTEAD-OF INSERT, UPDATE, and DELETE triggers allow you to directly insert,
update, and delete against object views. They can also be used with any other type of
view that does not allow direct DML.
When a view has an INSTEAD-OF trigger, the code in the trigger is executed in place
of the triggering DML code.

Reference For more information about INSTEAD-OF triggers, see:


Oracle8 Server SQL Reference Manual
Oracle8 Concepts Manual

......................................................................................................................................................
Oracle Developer: Build Reports F-25
Appendix F: Object Features in Oracle Developer
......................................................................................................................................................

Object REFs in
Object Navigator

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
F-26 Oracle Developer: Build Reports
Displaying Oracle8 Objects in the Object Navigator
......................................................................................................................................................

Object REFs
Object types that contain attributes of type REF, and relational tables that have
columns of type REF, display the keyword REF before the name of the object type that
is being referenced.
The attributes of the referenced object type are displayed indented underneath the
column or attribute.

......................................................................................................................................................
Oracle Developer: Build Reports F-27
Appendix F: Object Features in Oracle Developer
......................................................................................................................................................

Summary
• Oracle8 introduced three new scalar
datatypes.
• Objects and object types allow
representation of complex data.
• Three kinds of objects are object tables,
object columns, and object views.

Copyright  Oracle Corporation, 1999. All rights reserved.

Summary
• INSTEAD-OF triggers allow DML on
object views.
• Object REFs store the Object Identifier
of certain types of objects.
• The Object Navigator can display
certain types of objects.

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
F-28 Oracle Developer: Build Reports
Summary
......................................................................................................................................................

Summary
New Oracle8 Datatypes
Oracle8 introduced three new scalar datatypes and new composite dataypes such as
object types.

Objects
Three kinds of objects are object tables, object columns, and object views.
INSTEAD-OF triggers allow DML on object views.
Object REFs store the object identifier of certain types of objects.

Oracle8 Objects in the Object Navigator


The Object Navigator can display certain types of objects.

......................................................................................................................................................
Oracle Developer: Build Reports F-29
Appendix F: Object Features in Oracle Developer
......................................................................................................................................................

......................................................................................................................................................
F-30 Oracle Developer: Build Reports
G
................................

Using the Layout Editor in


Oracle Developer
Appendix G: Using the Layout Editor in Oracle Developer
......................................................................................................................................................

Lesson Objectives

• Control the position and size of objects


in a layout
• Add lines and geometric shapes
• Define the colors and fonts used for text
• Color the body and boundaries of
objects
• Import images onto the layout

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
G-2 Oracle Developer: Build Reports
Overview
......................................................................................................................................................

Overview
Introduction
In this lesson, you learn the graphical features of the Layout editor that are common to
all the Oracle Developer tools. This will help you control the visual arrangement and
appearance of objects in your applications.

Objectives
At the end of this lesson, you should be able to do the following:
• Control the position and size of objects in a layout
• Add lines and geometric shapes
• Define the colors and fonts used for text
• Color the body and boundaries of objects
• Import images onto the layout

......................................................................................................................................................
Oracle Developer: Build Reports G-3
Appendix G: Using the Layout Editor in Oracle Developer
......................................................................................................................................................

Using the Layout Editor

Common Features
•Moving and resizing objects and text
•Defining colors and fonts
•Importing and manipulating images
and drawings
•Creating geometric lines and shapes

Copyright  Oracle Corporation, 1999. All rights reserved.

Using the Layout Editor

Layout Types
• Canvas-views in Forms
• Display layers for Graphics
• Report layouts

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
G-4 Oracle Developer: Build Reports
Why Use the Layout Editor?
......................................................................................................................................................

Why Use the Layout Editor?


The Layout editor is a graphical tool for defining the arrangement and appearance of
visual objects. The Layout editor opens windows in the Oracle Developer Tool
Builders to present the surfaces on which you can arrange objects. Some objects only
occur in a subset of the Oracle Developer tools, and so the associated Layout editor
facility appears only there.
The following are common to each tool:
• Moving objects to new positions in the layout and aligning them with
each other
• Resizing objects and text
• Defining the colors of text and visual objects
• Creating lines, boxes, and other geometric shapes
• Importing and manipulating images on the layout
• Changing the font style and weight of text
• Accessing the properties of objects that you see in the layout

Layout Types
You can use the Layout editor to control the visual layout in each of the main Oracle
Developer Tools. The surfaces include:
• Canvas Views in Forms: A Canvas is the surface on which you arrange a
form’s objects. Its View is the portion of that Canvas that is initially
visible in a window at run time. You can also see Stacked or Tabbed
Canvas Views in the Layout editor; their views might overlay others in
the same window. You can also display stacked views in the Layout
editor.
• Display Layers in Graphics: The layers of a Display can contain charts,
text, and graphical objects. These layers can be overlaid or hidden when
required. Geometric shapes that you create in Graphics can be given
their own functionality.
• Layouts in Reports: Here, the Layout editor lets you plan the format of a
report. This includes the frame structure of the report, as well as buttons,
graphics, and background text (boilerplate).

......................................................................................................................................................
Oracle Developer: Build Reports G-5
Appendix G: Using the Layout Editor in Oracle Developer
......................................................................................................................................................

Invoking the Layout Editor

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
G-6 Oracle Developer: Build Reports
How to Access the Layout Editor
......................................................................................................................................................

How to Access the Layout Editor


You can invoke the Layout editor from either the builder menus or from the Object
Navigator. This applies whether you are doing so for the first time in a session or at a
later stage. If you have minimized an existing Layout Editor window, you can also
reacquire it in the way you would for any window.
Note: In Graphics, the Layout editor is open while you have a Display open.
Reports has three editors, the Layout editor, the Data Model editor, and the Parameter
Form editor, which are all displayed in the same window, one at a time.

How to Open from the Object Navigator


• Double-click the Layout icon within a report hierarchy, in Reports.
Or
• Double-click a Canvas View icon in a form hierarchy in Forms.

How to Open from the Builder Menus


1 Make sure that you have a context for either a report in Reports or a form
in Forms. You can do this by selecting the appropriate objects in the
Navigator.
2 In Forms, select Tools—>Layout Editor from the Builder menu.
In Reports, select View—>Layout Model from the Builder menu to set
the context for the Editor window.
In Forms, you can open several Layout Editor windows—one for each canvas-view.
Make sure that you have the canvas you want.

How to Close the Layout Editor


You can close or minimize the Layout Editor window or windows as you would any
window.
Closing a layout in Graphics implies that you want to close its entire display (the
Graphics module).

......................................................................................................................................................
Oracle Developer: Build Reports G-7
Appendix G: Using the Layout Editor in Oracle Developer
......................................................................................................................................................

Layout Editor: Components

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
G-8 Oracle Developer: Build Reports
The Layout Editor Components
......................................................................................................................................................

The Layout Editor Components


Common components in the Layout editor are:
• Menu facilities: While the Layout Editor window is active, the Main
builder menu changes to include three new items: View, Arrange, and
Format. These are submenus for controlling the Layout editor.
• Horizontal toolbar: This appears across the top of the window, and is a
subset of the tools from the Object Navigator.
• Style bar: This appears under the horizontal toolbar, and is a subset of
the Format menu. It may also contain some other tools.
• Vertical toolbar: This contains the tools for creating and modifying
objects on the layout. Some tools in the palette may be hidden if you
have reduced the size of the Layout Editor window. If so, scroll buttons
appear on the vertical toolbar.
There are three types of tools:
- Graphics tools for creating and modifying lines and shapes
- Product-specific tools
- Manipulation tools for controlling color and patterns
• Rulers and ruler guides: Rulers are horizontal and vertical markers to aid
alignment; they appear at the top and side of the layout region. You can
switch these off or have their units altered, as required. Drag ruler guides
from the rulers across the layout region to mark positions in the layout.
• Layout/Painting region: This is the main central/right area where you
can place and manipulate objects. A grid pattern is displayed in this area
to aid alignment of objects. You can switch off or rescale this grid if
required. (In Forms, the grid is hidden if the View—>Show Canvas
option is switched on.)
• Status line: This appears at the bottom of the window. It shows you the
mouse position and drag distance (when moving objects) and the current
magnification level.

......................................................................................................................................................
Oracle Developer: Build Reports G-9
Appendix G: Using the Layout Editor in Oracle Developer
......................................................................................................................................................

Tool Palette

1
2 8
3 9
4 10
5 11
6 12
7 13

Copyright  Oracle Corporation, 1999. All rights reserved.

1 Select 8 Rotate
2 Magnify 9 Reshape
3 Rectangle 10 Line
4 Ellipse 11 Arc
5 Polygon 12 Polyline
6 Rounded Rectangle 13 Freehand
7 Text

......................................................................................................................................................
G-10 Oracle Developer: Build Reports
Creating and Modifying Objects in the Layout
......................................................................................................................................................

Creating and Modifying Objects in the Layout


You can perform actions in the Layout editor by selecting from the vertical toolbar and
the builder menus, and by controlling objects directly in the layout region.

Creating Lines and Shapes


Create geometric lines and shapes by selecting from the graphics tools in the vertical
toolbar. These include:
• Rectangles/squares
• Ellipses/circles
• Polygons and polylines
• Lines and arcs
• Freehand tool
The default tool in the vertical toolbar is Select, which lets you select and move
objects.

How to Create a New Line or Shape


1 Select the required graphic tool from the vertical toolbar with a mouse
click. This selects the tool for a single operation on the layout (a double-
click causes the tool to remain active for subsequent operations).
2 Position the cursor at the start point for the new object in the layout and
then click-and-drag to the required size and shape.
3 Release the mouse button.
Notice that the object remains selected after this procedure (selection handles appear
on its boundaries) until you deselect it by clicking elsewhere.
Note: You can produce constrained shapes (for example, a circle instead of an ellipse)
by depressing the [Shift] key during step 2.

Creating Text (T)


The Text tool (T) lets you open a Boilerplate Text object on the layout. You can type
one or more lines of text into this object while it is selected with the Text tool. Uses of
Text objects vary according to the Oracle Developer tool in which you create them.

......................................................................................................................................................
Oracle Developer: Build Reports G-11
Appendix G: Using the Layout Editor in Oracle Developer
......................................................................................................................................................

Selecting Objects

Copyright  Oracle Corporation, 1999. All rights reserved.

Manipulating Objects

Expand/Contract
in One Direction

Expand/Contract
Diagonally

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
G-12 Oracle Developer: Build Reports
Creating and Modifying Objects in the Layout
......................................................................................................................................................

Selecting Objects for Modification


With the Select tool active, you can select one or more objects on the layout to move
or modify.

How to Select One Object


• Click the object
Or
• Draw a bounding box around it the object using click-and-drag
If the object is small or narrow, it is sometimes easier to use the second method. Also,
an object may be transparent (No Fill), which can present a similar problem where it
has no center to select.
It is convenient to select several objects, so that an operation can be performed on
them simultaneously.

How to Select Several Objects Together


• Hold down the [Shift] key and then click each object to be selected
Or
• Draw a bounding box around the objects using click-and-drag
(providing the objects are adjacent to each other)

Changing the Size or Ratio


When an object is selected, there are two types of selection handles visible:
• Corner handles: Position the cursor on one of these to change the size/
ratio of the object diagonally.
• Midpoint handles: Position the cursor on one of these to change the size/
ratio in a horizontal or vertical direction.
Note: Holding down the [Shift] key lets you resize an object without changing its
ratios. This means that squares remain as squares, and bitmapped images do not
become distorted when resized.

......................................................................................................................................................
Oracle Developer: Build Reports G-13
Appendix G: Using the Layout Editor in Oracle Developer
......................................................................................................................................................

Moving, Aligning, and


Overlapping

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
G-14 Oracle Developer: Build Reports
Creating and Modifying Objects in the Layout
......................................................................................................................................................

Moving and Aligning Objects


When one or more objects are selected in the layout, you can:
• Move them to a new location
Do this by dragging to the required position and releasing the mouse button. You
can use the grid and ruler lines to help you position them properly.
• Align the objects with each other
Objects can be aligned with the left-most, right-most, highest, or lowest object
selected. They can also be centered, and aligned with the grid. You can do this
using the Alignment feature on the Arrange menu:
Select Arrange—>Align Objects and then set the options required in the
Alignment Settings dialog box.

A Note on Grid-Snap Alignment


You can ensure that all objects that you move align with snap points that are defined
on the grid. To activate these, select View—>Snap to Grid from the menu. You can
also use the View options to change the grid-snap spacing and units.
Note: If you position an object using one grid-snap spacing, and then try to position
other objects under different settings, it may prove difficult to align them with each
other.
Try to stick to the same snap units, if you use Grid Snap at all.

Overlapping Objects
You can position objects on top of each other. If they are transparent, then one object
can be seen through another (this is explained in detail later in this lesson).
Change the stacking order of overlapping objects by selecting the object to move and
then choosing the following, as required, from the Arrange menu:
• Bring to Front
• Send to Back
• Move Forward
• Move Backward

......................................................................................................................................................
Oracle Developer: Build Reports G-15
Appendix G: Using the Layout Editor in Oracle Developer
......................................................................................................................................................

Groups in the Layout

• Groups allow several objects to be


repeatedly treated as one.
• Groups can be colored, moved or
resized.
• Tool-specific operations exist for
groups.
• Groups have a single set of selection
handles.
• Members can be added or removed.
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
G-16 Oracle Developer: Build Reports
Creating and Modifying Objects in the Layout
......................................................................................................................................................

How to Manipulate Objects as a Group


Sometimes you want to group objects together in the layout so that they behave as a
single object.
1 Select the objects on the layout that are to be grouped together.
2 Select Arrange—>Group from the menu.
Notice that there is now just a single set of selection handles for the group, which you
can treat as a single object whenever you select a member within it. The Arrange menu
also gives you options to add and remove members. Resizing, moving, coloring, and
other operations now apply to the whole group.
Groups have different implications depending on the Oracle Developer tool that is
using them. Graphics, for example, can reference a group in the layout
programmatically.

Manipulating Individual Group Members


To manipulate group members individually, select the group, then click on the
individual member. You can use options in the Group Operations menu to remove
objects from the group or to reselect the parent group.

Other Tools for Manipulating Objects


• Rotate: The Rotate tool lets you rotate a line or shape through an angle,
using its selection handles.
• Reshape: Reshape lets you change the size/ratio of a shape that has been
rotated, or change the sweep angle of an arc. You can also reshape a
polygon or polyline.
• Magnify: The Magnify tool lets you increase magnification when you
click at a desired zoom position on the layout region. [Shift] + click
reduces magnification.
Note: You can undo your previous action in the current Layout editor session by
selecting Edit—>Undo from the menu.

......................................................................................................................................................
Oracle Developer: Build Reports G-17
Appendix G: Using the Layout Editor in Oracle Developer
......................................................................................................................................................

Format Menu

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
G-18 Oracle Developer: Build Reports
Formatting Objects in the Layout
......................................................................................................................................................

Formatting Objects in the Layout


The Format menu provides a variety of facilities for changing the style and appearance
of objects in the layout. These include:
• Font sizes and styles
• Spacing in lines of text
• Alignment of text within a text object
• Line thickness and dashing of lines
• Bevel (3D) effects on objects
• General drawing options (style of curves, corners, and so on)
Whichever formatting option you intend to use, first select the objects that you intend
to change on the layout, then choose the necessary option from the Format menu.
Some of the format options are available from the style bar.

How to Change Fonts on Textual Objects


There are a number of ways to change the font characteristics of textual objects; they
depend on which Oracle Developer tool you are using. The common methods
provided by the Layout editor are:
1 Select the objects in the layout whose content text you want to change
(these may be Boilerplate Text objects and other textual object types
supported by the Oracle Developer tool you are using).
2 Choose the font style and size that you require from the style bar; or
select Format from the Main Builder menu and choose the font style and
size that you require.
Note: In Microsoft Windows, choosing Font from the menu opens the standard
Windows Font dialog box. In other GUI environments, the font choices may appear in
the Format menu itself. Font settings are ignored if the application is run in character
mode.

......................................................................................................................................................
Oracle Developer: Build Reports G-19
Appendix G: Using the Layout Editor in Oracle Developer
......................................................................................................................................................

Color and Pattern Tools


1

2
3
4

Copyright  Oracle Corporation, 1999. All rights reserved.

1 Sample window
2 Fill color/pattern
3 Line color
4 Text color

......................................................................................................................................................
G-20 Oracle Developer: Build Reports
Coloring Objects and Text
......................................................................................................................................................

Coloring Objects and Text


There are three tools in the vertical toolbar for coloring objects:
• Fill Color: Use this tool to define the colors and pattern for an object’s
body.
• Line Color: Use this tool to define the color of a line or the boundary line
around an object.
• Text Color: Use this tool to choose the color for text.

Coloring Objects
You can separately color the Fill area (body) of an object and its boundary line (a Line
object has no body).

......................................................................................................................................................
Oracle Developer: Build Reports G-21
Appendix G: Using the Layout Editor in Oracle Developer
......................................................................................................................................................

How to Choose the Fill Area Color


1 Select the objects whose color you want to change.
2 Select the Fill Color tool. The color palette appears.
If you want the objects to become transparent, choose No Fill at the
bottom of the color palette window.
3 Select a color. If you want the Fill Area to be patterned instead of plain,
then select Patterns from the bottom of the color palette.
4 If you select Patterns, another window appears from which you can
select a pattern. You can define separate colors for the two shades of the
pattern by choosing the pattern color buttons at the bottom of the Fill
Pattern palette. Each of these buttons opens another color palette

How to Choose the Line Color


1 With the desired layout objects selected, click the Line Color tool. The
line color palette opens.
2 Choose the color for lines and bounding lines from this color palette.
Select No Line at the bottom of this window to remove the objects’
boundary lines.
Note: If you set both No Fill and No Line, the affected objects become invisible.

......................................................................................................................................................
G-22 Oracle Developer: Build Reports
Coloring Objects and Text
......................................................................................................................................................

How to Color Text


1 Select the textual objects whose color you want to change in the layout.
2 Select the Text Color tool. The color palette appears, showing the
available colors.
3 Click a square to select a color.
4 Notice that the selected objects on the layout have adopted the chosen
text color. Also, the sample area in the vertical toolbar shows a T with
the selected color, and this color appears next to the Text Color tool. This
indicates the current text color setting.

How to Alter the Color Palette


Choose Format—>Layout Options—>Color Palette to alter the color palette. You can
edit the color palette that is presented when choosing colors. This option is available
only when the builder option Color Palette Mode is set to Editable. Changes to the
color palette are saved with the current module.
Note: Modifications to the Color palette are not apparent until you close the document
and reopen it.

......................................................................................................................................................
Oracle Developer: Build Reports G-23
Appendix G: Using the Layout Editor in Oracle Developer
......................................................................................................................................................

Importing Images

Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
G-24 Oracle Developer: Build Reports
Importing Images and Drawings
......................................................................................................................................................

Importing Images and Drawings


Oracle Developer tools allow both static and dynamic bitmapped images to be
integrated into the application. You can import static images and drawings; that is,
ones that are fixed on the layout. These might include:
• Company logos
• Photographs for inclusion in a report or display
• Background artwork

Importing Drawings
These are line art files, which you can import onto the layout from either the
filesystem or the database. Select File—>Import—>Drawing from the menu and
specify the source in the Import dialog box. The format can be Oracle or a CGM file.

Importing Images
Select File—>Import—>Image from the menu and set the Import Image options:
Option Description
(Option buttons) File/Database Where to import from
Filename File to be imported
Format Image format (BMP, TIFF, PCX, PICT, GIF, CALS,
RAS, Oracle Format, and PCD [Kodak Photo CD])
Quality Range from Excellent to Poor; this is a tradeoff
between image resolution and memory required

Manipulating the Imported Image or Drawing


When the imported image or drawing appears on the layout, you can move it or resize
it like other objects on the layout. When resizing images, it is usually better to do so in
Constrained mode (while pressing the [Shift] key) so the image does not become
distorted.

......................................................................................................................................................
Oracle Developer: Build Reports G-25
Appendix G: Using the Layout Editor in Oracle Developer
......................................................................................................................................................

Summary
• Create objects by:
1. Choosing a palette tool
2. Clicking and dragging on layout region
• Color palette tools for fill area, lines, and
text
• View, arrange, and format menus available
for layout
• Objects may be grouped for operations
• Import images and drawings by
File—>Import
Copyright  Oracle Corporation, 1999. All rights reserved.

......................................................................................................................................................
G-26 Oracle Developer: Build Reports
Summary
......................................................................................................................................................

Summary
• Create objects by:
- Choosing the correct toolbar tool.
- Clicking and dragging the Layout region.
• There are color palette tools for Fill Area, Lines, and Text.
• View, Arrange, and Format menus are available while you are in the
Layout editor.
• You can group objects for operations.
• Import images and drawings by selecting Edit—>Import.

......................................................................................................................................................
Oracle Developer: Build Reports G-27
Appendix G: Using the Layout Editor in Oracle Developer
......................................................................................................................................................

......................................................................................................................................................
G-28 Oracle Developer: Build Reports

You might also like