My trigger example:
CREATE OR REPLACE TRIGGER InventoryOthersMstrUpdate
BEFORE INSERT OR UPDATE ON INVENTORY_OTHERS_MSTR
FOR EACH ROW
BEGIN
IF (:NEW.TOTL_LEFT<>:OLD.TOTL_LEFT
OR :NEW.TOTL_QTY<>:OLD.TOTL_QTY
OR :NEW.TOTL_RESERVED<>:OLD.TOTL_RESERVED
OR :NEW.HCARE_RESERVED_QTY<>:OLD.HCARE_RESERVED_QTY)
THEN INSERT INTO INVENTORY_OTHERS_MSTR_TRACE (OTHERS_MSTR_ID, CATALOGUE_MSTR_ID, LAST_UPDATED_BY, LAST_UPDATED_ON, LAST_UPDATED_AT, CHECK_IND, LOCK_IND, LOC_IND, MAINTAIN_QTY, TOTL_QTY, TOTL_RESERVED, TOTL_LEFT, TOTL_LOAN, HCARE_RESERVED_QTY, LOC_ID)
VALUES (:OLD.OTHERS_MSTR_ID, :OLD.CATALOGUE_MSTR_ID,
:OLD.LAST_UPDATED_BY, :OLD.LAST_UPDATED_ON,
:OLD.LAST_UPDATED_AT, :OLD.CHECK_IND, :OLD.LOCK_IND, :OLD.LOC_IND, :OLD.MAINTAIN_QTY, :OLD.TOTL_QTY, :OLD.TOTL_RESERVED, :OLD.TOTL_LEFT, :OLD.TOTL_LOAN, :OLD.HCARE_RESERVED_QTY, :OLD.LOC_ID);
END IF;
END;
/
参考:
http://www.chinaunix.net/jh/21/21696.html
posted on 2006-11-16 18:06
snbna 阅读(160)
评论(0) 编辑 收藏 所属分类:
Java的世界