Mimer SQL User's Manual TOC PREV NEXT INDEX

Mimer Developer Site

www.mimer.com/developer


Triggers


In addition to stored routines, Mimer SQL supports triggers. Triggers can be considered to be a special form of a stored procedure; they are not called directly by a user, they execute automatically when a data modification statement is used against a table. Triggers can be defined to execute either before or after rows are inserted into a table; when rows are deleted from a table; and when columns are updated in the rows of a table. Triggers incorporate virtual tables that reflect the row image before and after the operation, as appropriate.

Tables can have multiple triggers and Mimer SQL supports multiple triggers for each modification event on a table. Triggers can be called recursively, both indirect and direct.

Triggers are an extension to the concepts behind constraints, except that they can provide a greater flexibility because the trigger body allows a greater level of control. Their primary use is to enforce complex business rules or requirements. Triggers can be used to extend the integrity checking logic of constraints, defaults and rules; constraints and defaults should be used instead if they can encapsulate all the needed functionality. Unlike check constraints, triggers can reference columns in other tables. A trigger can reject the attempted modification that caused the trigger to execute.

Mimer SQL also supports an INSTEAD OF qualifier to the INSERT, DELETE and UPDATE triggers, which provides a mechanism to make any view updateable. In this case, it is expected that the trigger will modify one or more tables to simulate the data modification statement on the view.



Upright Database Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40
dbtechnology@upright.se
Mimer SQL User's Manual TOC PREV NEXT INDEX