CREATE OR REPLACE TRIGGER TGR_NAME
AFTER UPDATE ON TABLE1_NAME
FOR EACH ROW
DECLARE
V_COUNT NUMBER(10);
BEGIN
SELECT COUNT(*) INTO V_COUNT FROM TABLE2_NAME WHERE ZJ=:NEW.ZJ;
IF V_COUNT = 0 THEN
INSERT INTO TABLE2_NAME (ZJ,MC)
VALUES(:NEW.ZJ,:NEW.MC);
ELSE
UPDATE TABLE2_NAME SET MC=:NEW.MC WHERE ZJ=:OLD.ZJ;
END IF;END;