Trigger

#### Search Results

Search

# Trigger

This object type is used to define triggers for SQL tables and SQL table fields.

In the predefined Predict metastructure, a trigger can have passive and active associations of the following types:

Valid passive associations: | "Triggers FI" (default passive association) "Triggers EL "
Valid active association: | no predefined association

This document covers the following topics:

- Trigger Maintenance Menu

- Add a Trigger Screen

- Editing the Trigger Code of a Trigger

- Trigger Retrieval

## Trigger Maintenance Menu

This menu is called with function code M and object code TR in a Predict main menu or with the command `MAINTAIN TRIGGER`.

    13:54:29             *****  P R E D I C T  *****             2007-05-31
    Plan  10                - (TR) Trigger Maintenance -               Profile HNO

     Function                              Function

     A  Add a Trigger                      D  Display Trigger
     C  Copy Trigger                       L  Link children
     M  Modify Trigger                     S  Select Trigger from list
     N  Rename Trigger
     P  Purge Trigger

    Function ..............
    Trigger ID ............                                  Attributes....*
    Copy ID ...............
    Triggers FI ...........

    Restrictions .........*   Profile HNO,used              Association ...*

    Command ===>

    Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
          Help  Next  Stop  Last  LnkEl Flip  Print Impl  AdmFi SelFi Prof  Main

Note
Parameters not listed here are described under Global Attributes.

Parameters
Function | Enter one of the codes from the menu to execute one of the maintenance functions. These functions are described in the section Maintenance in the Predict Reference documentation.

## Add a Trigger Screen

The following screen is called for function Add a Trigger. The screens for functions Copy and Modify are similar.

    13:54:29             *****  P R E D I C T  *****            2007-05-31
                                 - Add a Trigger -
    Trigger .........  HNO-TR
    Triggers FI ....*
    Keys ..                                                               Zoom: N
    Attributes
     Trigger name ....
     Trigger action ..*
     Trigger type ....*
     Abstract    Zoom: N

     Aditional attributes ..* N          Associations ..* N

Note
Parameters not listed here are described under Global Attributes.

Parameters
Trigger ID | ID of the trigger.
Triggers FI | ID of the parent file.
Trigger name | Name of the trigger.
Trigger action | Activating a trigger with the statement: Insert Update Delete
Trigger type | Activation time of a trigger: After Before None

## Editing the Trigger Code of a Trigger

#### Calling the Editor

Two methods are available for calling an editor to edit the Trigger code of Trigger:

- enter `Y` in the Additional attributes field in the bottom line of the Add/Copy/Modify Trigger screen and select Trigger code from the menu, or

- enter the command `EDIT TRIGGER TRIGGER <Trigger ID>`.

The editor called depends on the preferences specified in the Profile > Handling screen:

- if your first choice editor is "NATURAL", the Subquery Editor (a modified Natural Editor) is called,

- if your first choice editor is "SAG" or "Word for Windows", the Software AG Editor is called.

    13:54:29                       - TR: HEB-TR -                       2007-05-31
          ------------------- <Trigger code> -------------------

    ***** ***************************** top of data***************************
    00001 save
    ***** *************************** bottom of data**************************

    Command ===>                                                    Scroll==> CSR
    Enter-PF1---PF2---PF3---PF4---PF5---PF6---PF7---PF8---PF9---PF10--PF11--PF12---
          Help        Exit        Rfind Rch   up    down        left  right leave

## Trigger Retrieval

Only standard retrieval functions are used. See the section Retrieval in the Predict Reference documentation.

### Layout of Trigger Lists

Trigger lists contain the trigger IDs and the trigger names.

    13:19:16             *****  P R E D I C T  *****             2007-05-31
                                  - List Trigger -

    ------------------------------------------------------------------------------
    Cnt  Trigger ID                       Trigger name

       1 HEB-TR-DEL                       HEB-TR-DEL
       2 HEB-TR-INS                       HEB-TR-INS
       3 HNO-TR1                          Trigger1

### Output Options for Trigger Retrieval

The output options valid for this object type are identical to those for object type Dataspace. See Output Options for Dataspace Retrieval.

### On this page

- Trigger Maintenance Menu
- Add a Trigger Screen
- Editing the Trigger Code of a Trigger
- Trigger Retrieval