A script-enabled browser is required for this page to function properly.

About report triggers

Report triggers execute PL/SQL functions at specific times during the execution and formatting of your report. Using the conditional processing capabilities of PL/SQL for these triggers, you can do things such as customize the formatting of your report, perform initialization tasks, and access the database. To create or modify a report trigger, you use the Report Triggers node in the Object Navigator. Report triggers must explicitly return TRUE or FALSE.

Oracle Reports has five global report triggers. You cannot create new global report triggers. The trigger names indicate at what point the trigger fires:

Before Report trigger

Fires before the report runs but after queries are parsed.

After Report trigger

Fires after you exit the Paper Design view, or after report output is sent to a specified destination, such as a file, a printer, or an e-mail ID. This trigger can be used to clean up any initial processing that was done, such as deleting tables. Note, however, that this trigger always fires, whether or not your report completed successfully.

Between Pages trigger

Fires before each page of the report is formatted, except the very first page. This trigger can be used for customized page formatting. In the Paper Design view, this trigger only fires the first time that you go to a page. If you subsequently return to the page, the trigger does not fire again.

Before Parameter Form trigger

Fires before the Runtime Parameter Form is displayed. From this trigger, you can access and change the values of parameters, PL/SQL global variables, and report-level columns. If the Runtime Parameter Form is suppressed, this trigger still fires. Consequently, you can use this trigger for validation of command line parameters.

After Parameter Form trigger

Fires after the Runtime Parameter Form is displayed. From this trigger, you can access parameters and check their values. This trigger can also be used to change parameter values or, if an error occurs, return to the Runtime Parameter Form. Columns from the data model are not accessible from this trigger. If the Runtime Parameter Form is suppressed, the After Parameter Form trigger still fires. Consequently, you can use this trigger for validation of command line parameters or other data.

Order of report trigger execution

The order of events when a report is run is as follows:

  1. Before Parameter Form trigger is fired.

    Note: If the Parameter Form is used on the Web, the Before Parameter Form trigger fires twice: once when the Parameter Form is displayed, and a second time when the parameters are submitted. This is because Oracle Reports executes in a stateless fashion. There is no session to return to, so the Before Parameter Form trigger has to fire the second time to ensure that the parameters selected on the Parameter Form and passed on the command line are valid.

  2. Runtime Parameter Form appears (if not suppressed).

  3. After Parameter Form trigger is fired (unless the user cancels from the Runtime Parameter Form).

  4. Report is "compiled".

  5. Queries are parsed.

  6. Before Report trigger is fired.

  7. SET TRANSACTION READONLY is executed (if specified with the READONLY command line keyword or setting).

  8. The report is run and the Between Pages trigger fires for each page except the first one. (Note that data can be fetched at any time while the report is being formatted.) COMMITs can occur during this time due to: SRW.DO_SQL with DDL, or if ONFAILURE=COMMIT, and the report fails.

  9. COMMIT is executed (if READONLY is specified) to end the transaction.

  10. After Report trigger is fired.

  11. COMMIT/ROLLBACK/NOACTION is executed based on what was specified with the ONSUCCESS command line keyword or setting.

Usage notes

Restrictions

See also

About triggers

Creating a report trigger

Deleting a report trigger