Skip Headers
Oracle® Fusion Middleware Data Modeling Guide for Oracle Business Intelligence Publisher (Oracle Fusion Applications Edition)
11g Release 1 (11.1.1)
E26386-01
  Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next
 

5 Adding Event Triggers

This chapter describes how to add event triggers and schedule triggers to the BI Publisher data model.

It includes the following topics:

5.1 About Triggers

The BI Publisher data model supports the following types of triggers:

An event trigger checks for an event and when the event occurs, it runs the code associated with the trigger. The BI Publisher data model supports before data and after data triggers that execute a PL/SQL function stored in a PL/SQL package in your Oracle Database. The return data type for a PL/SQL function inside the package must be a Boolean type and the function must explicitly return TRUE or FALSE.

A schedule trigger is associated with a schedule job. It is a SQL query that is executed at the time a report job is scheduled to run. If the SQL returns any data, the report job runs. If the SQL query returns no data, the job instance is skipped.

5.2 Adding Before Data and After Data Triggers

To add a before data or after data event trigger:

  1. From the data model Properties pane, enter the Oracle DB Default Package that contains the PL/SQL function signature to execute when the trigger fires. See Section 1.8, "Setting Data Model Properties."

  2. From the task pane, click Event Triggers.

  3. From the Event Triggers pane, click the Create New icon.

  4. Enter the following for the trigger:

    • Name

    • Type — Select Before Data or After Data.

    • Language — Select PL/SQL.

      The lower pane displays the available functions in the Oracle DB Default Package that you entered in the data model Properties in Step 1.

      Figure 5-1 shows an event trigger.

      Figure 5-1 Event Trigger

      Event trigger
  5. Select the package from the Available Functions box and click the arrow to move a function to the Event Trigger box. The name appears as PL/SQL <package name>.<function name>.


    Important:

    If you define a default package then you must define all parameters as a global PL/SQL variable in the PL/SQL package. You can then explicitly pass parameters to your PL/SQL function trigger or all parameters are available as a global PL/SQL variable.


5.2.1 Order of Execution

If you define multiple triggers of the same type, they fire in the order that they appear in the table (from top to bottom).

To change the order of execution:

  1. Use the Reorder arrows to place the triggers in the correct order.

5.3 Creating Schedule Triggers

A schedule trigger fires when a report job is scheduled to run. Schedule triggers are of type SQL Query. When a report job is scheduled to run, the schedule trigger executes the SQL statement defined for the trigger. If data is returned, then the report job is submitted. If data is not returned from the trigger SQL query, the report job is skipped.

The schedule trigger that you associate with a report job can reside in any data model in the catalog. You do not need to create the schedule trigger in the data model of the report for which you which to execute it. You can therefore reuse schedule triggers across multiple report jobs.

To add a Schedule Trigger:

  1. In the data model editor task pane, click Event Triggers.

  2. From the Event Triggers pane, click the Create New icon.

  3. Enter the following for the trigger:

    • Name - enter a name for the trigger.

    • Type — select Schedule.

    • Language — defaults to SQL Query.

  4. In the lower pane, enter the following:

    • Options - select this box to cache the results of the trigger query.

    • Data Source - select the data source for the trigger query.

    • SQL Query - enter the query in the text area, or click Query Builder to use the utility to construct the SQL query. For information, see Section 2.4, "Using the Query Builder."

    It the SQL query returns any results, the scheduled report job executes. Figure 5-2 shows a schedule trigger to test for inventory levels.

    Figure 5-2 Schedule Trigger

    Surrounding text describes Figure 5-2 .

    For information on implementing the schedule trigger in the report job, see "Defining the Schedule for a Job" in the Oracle Fusion Middleware User's Guide for Oracle Business Intelligence Publisher.