The c_trig.sql command file

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));

Copyright© 2018 HCL Technologies Limited