Oracle触发器实现插入或更新一张表数据同时插入或更新另一张表

时间:2022-10-02 00:48:45

CREATE OR REPLACE TRIGGER tri_loan_into_interest
AFTER INSERT OR UPDATE ON loan_info
FOR EACH ROW
BEGIN
IF INSERTING THEN
INSERT INTO interest_info (lid,cid,lsum,status)
VALUES(:NEW.lid,:NEW.cid,:new.lsum,:new.status);
ELSIF UPDATING THEN
UPDATE interest_info SET status=:NEW.status WHERE lid=:OLD.lid;
END IF; END;