Oracle triggers to achieve insert or update a table insert or update data while another table

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;

Guess you like

Origin www.cnblogs.com/gfd1511/p/10994868.html