Home | Previous Page | Next Page   Appendix B. Demonstration SQL > SQL Files for the Relational Database Model >

c_trig.sql

The following command file creates a table named log_record and then creates a trigger named upqty_i, which updates it:

CREATE TABLE log_record
   (item_num    SMALLINT,
   ord_num      INTEGER,
   username     CHARACTER(8),
   update_time  DATETIME YEAR TO MINUTE,
   old_qty      SMALLINT,
   new_qty      SMALLINT);

CREATE TRIGGER upqty_i
UPDATE OF quantity ON items
REFERENCING OLD AS pre_upd
        NEW AS post_upd
FOR EACH ROW(INSERT INTO log_record
   VALUES (pre_upd.item_num, pre_upd.order_num, USER, CURRENT,
        pre_upd.quantity, post_upd.quantity));
Extended Parallel Server

Extended Parallel Server does not support triggers.

End of Extended Parallel Server
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]