Try OpenEdge Now
skip to main content
Basic Database Tools
Schema Menu Reference : Modify Table option : Table Triggers option
 

Table Triggers option

The Table Triggers option in the Modify Table dialog box allows you to define schema triggers for a table. If you choose Table Triggers, the Table Triggers window shown in the following figure appears.
Figure 23. Table Triggers dialog box
The Table Triggers dialog box contains the following fields:
*Overrideable — Specifies whether a session trigger can override the schema trigger. The default value is no. See OpenEdge Getting Started: ABL Essentials for more information about schema and session triggers.
*Check CRC — Specifies whether the database engine verifies the cyclical redundancy check (CRC) code. The default value is yes. If this option is on, then the AVM stores in the metaschema, along with the trigger procedure name, a unique Cyclic Redundancy Check (CRC) identifier for the compiled version of the trigger procedure. The AVM raises an error if the r-code file it encounters at run time does not match or if there is no compiled version of the procedure.
*Trigger Programs — Choose the database event for the trigger you want to create. The following table lists the available database events.
Table 8. Table Trigger events
Event
Description
CREATE
Specifies that the trigger executes every time a CREATE or INSERT statement executes for the table you are modifying.
DELETE
Specifies that the trigger executes every time a DELETE statement executes for the table you are modifying.
FIND
Specifies that the trigger executes every time a record in the table you are modifying is read using a FIND statement or a FOR EACH loop. Only records that satisfy the full search conditions (such as a WHERE clause) cause a FIND trigger to execute. The CAN-FIND statement does not cause a FIND trigger to execute.
WRITE
Specifies that the trigger executes every time OpenEdge RDBMS validates a record. OpenEdge RDBMS automatically validates a record when it releases it.
Note: OpenEdge RDBMS does not compare the new record with the old record when determining if it should fire the WRITE trigger. Even temporary changes to a table (as when a field is changed, then changed back to its original value) cause WRITE to fire. If it is necessary to handle this situation, use the NEW BUFFER and OLD BUFFER options in your trigger procedure to compare the values and detect a "dummy" change case.
Specifies the trigger that executes immediately following the execution of the CREATE trigger (if you specify a CREATE trigger). The purpose of the trigger is to replicate the creation of records to another database.
REPLICATION- DELETE
Specifies the trigger that executes immediately following the execution of the DELETE trigger (if you specify a DELETE trigger). The purpose of the trigger is to replicate the deletion of records to another database.
REPLICATION- WRITE
Specifies the trigger that executes immediately following the execution of the WRITE trigger (if you specify a WRITE trigger). The purpose of the trigger is to replicate updated records to another database.
Press F6 to display the trigger code dialog box. The following figure shows an example of a delete trigger procedure.
Figure 24. Example of a delete trigger procedure