Try OpenEdge Now
skip to main content
SQL Development
Stored Procedures and Triggers : Working with triggers
 

Working with triggers

Database triggers are not part of the SQL standard, but are supported in the OpenEdge environment. Triggers are a special type of stored procedure used to maintain database integrity by enforcing specific business logic.
Database triggers are supported using Java. The OpenEdge SQL Engine adds wrapper code around a trigger to create a Java class and method that is invoked when the trigger fires. When creating a database trigger, the compiled Java class generated is stored within the database as well as the original source.
Triggers are a special type of stored procedure used to maintain database integrity.
Like stored procedures, triggers also contain Java code (embedded in a CREATE TRIGGER statement) and use OpenEdge SQL Java classes. However, triggers are automatically invoked (fired) by certain SQL operations (an insert, update, or delete operation) on the trigger's target table.
This section provides a general description of triggers and discusses in detail where trigger procedures differ from stored procedures. Unless otherwise noted, the material in earlier sections of this chapter also applies to triggers.
* Creating triggers
* Structure of triggers
* Triggers, stored procedures, and constraints
* Typical uses for triggers
* OLDROW and NEWROW objects: passing values to triggers
* getValue method for NEWROW and OLDROW
* Assigning null values from SQL OLDROW and NEWROW statement objects: the OLDROW.isNULL method and NEWROW.isNULL