Creating a Trigger
A trigger is created by using the CREATE TRIGGER statement, see the Mimer SQL Reference Manual, CREATE TRIGGER.
Example:CREATE TRIGGER products_after_insert AFTER INSERT ON products REFERENCING NEW TABLE AS pdt FOR EACH STATEMENT BEGIN ATOMIC -- Force the update trigger to fire UPDATE products SET product_search = DEFAULT WHERE product_id IN (SELECT product_id FROM pdt); END -- of trigger products_after_insert
A trigger is created on a named table or view and the trigger must be created in the schema to which the table or view belongs. If the trigger is created on a base table, the table must be stored in a databank with the TRANS or LOG option.
The trigger name must follow the rules for naming private database objects, see the Mimer SQL Reference Manual, Naming Objects, and the name must be unique within the schema in which the trigger is created.
You can create any number of triggers on a named table, each of which may have the same trigger time, see Trigger Time, and trigger event, see Trigger Event, specified.
If two or more triggers exist on the same table with the same trigger time and trigger event, they will be executed in an order determined by their internal creation timestamp.
Note: When triggers are created using BSQL, the create statement must be delimited by the @ character.
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40