Program units are packages, functions, or procedures that you can reference from any PL/SQL within the current report.
Note: Program units cannot be referenced from other documents. If you want to create a package, function, or procedure that can be referenced from multiple documents, create an external PL/SQL library.
For a detailed example of using PL/SQL in a report, see the chapter "Building
a PL/SQL Report" in the Oracle Reports Building Reports manual,
available on the Oracle Technology Network
Oracle Reports Documentation page (http://www.oracle.com/technology/documentation/reports.html
).
If you delete a PL/SQL package, function, or procedure, you must also delete all references to it in your report. Otherwise, you will get an error when you compile, generate, or run the report.
PL/SQL package, function, and procedure names must be unique within the report and may not duplicate the names of any columns, groups, queries, or printable objects.
Suppose that you have a report with the following groups and columns:
Groups Columns Summary
-----------------------------------------
RGN REGION
RGNSUMSAL SUM(DEPTSUMSAL)
COSTOFLIVING
DEPT DNAME
DEPTNO
DEPTSUMSAL SUM(EMP.SAL)
JOB JOB
HEADCOUNT COUNT(EMP.EMPNO)
EMP ENAME
EMPNO
SAL
COMM
Given these groups and columns, you might create multiple formulas that apply
the cost of living factor (COSTOFLIVING
) to salaries. To avoid
duplication of effort, you could create the following PL/SQL function and reference
it from the formulas:
function CompSal(salary number) return number is
begin
return (salary*CostofLiving);
end;
Following are some examples of how you might reference the PL/SQL function in formulas:
CompSal(:RGNSUMSAL)
or
CompSal(:SAL) + COMM
About external PL/SQL libraries
Copyright © 1984, 2005, Oracle. All rights reserved.