Mimer SQL Documentation TOC PREV NEXT INDEX

Mimer SQL Developer Site


Trigger Time


The trigger time specifies when, in relation to the execution of the triggering data manipulation statement, the trigger is executed.

The possible values for the trigger time are:

If the trigger time specified is AFTER or BEFORE, the table name must specify a base table which is located in a databank with the TRANS or LOG option.

If the trigger time specified is INSTEAD OF, the table name must specify a view.

Example:

Example of an instead of trigger, which can be used for handling join views.

 CREATE TRIGGER book_details_instead_of_update
    INSTEAD OF UPDATE ON mimer_store_book.book_details
 REFERENCING  NEW TABLE AS new_bd
 BEGIN ATOMIC
 --
 -- Update one table with some of the data from the join view
 --
    UPDATE titles
       SET authors_list = (SELECT authors_list
                             FROM new_bd
                            WHERE item_id = titles.item_id)
     WHERE item_id IN (SELECT item_id
                         FROM new_bd);
 --
 -- Update another table using another column from the join view
 --
   UPDATE producers
      SET producer_name = (SELECT publisher
                             FROM new_bd
                            WHERE item_id = producers.producer_id)
    WHERE producer_id IN (SELECT item_id
                            FROM new_bd);
 END

Mimer
Mimer Information Technology AB
Voice: +46 18 780 92 00
Fax: +46 18 780 92 40
info@mimer.se
Mimer SQL Documentation TOC PREV NEXT INDEX