1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
CREATE OR REPLACE TRIGGER trg_CODMETHODSRC BEFORE INSERT OR UPDATE OR DELETE ON CODMETHODSRC FOR EACH ROW
...
IF INSERTING THEN
MERGE INTO E1XL0.CODMETHODSRC d USING (SELECT 1 FROM dual)
ON (...)
WHEN MATCHED THEN UPDATE SET d.IMAGE = :new.IMAGE ...
WHEN NOT MATCHED THEN INSERT (d.VERSION,d.PACKAGE,d.TARGET,d.RESOURCENAME,d.RESOURCEKIND,d.IMAGE,d.LOCKED,d.CHG_DATE,d.CHG_USER,d.CHG_TYPE,d.ID) VALUES (:new.VERSION,:new.PACKAGE,:new.TARGET,:new.RESOURCENAME,:new.RESOURCEKIND,:new.IMAGE,:new.LOCKED,dteTimeStamp,NULL,strChgType,:new.VERSION || '-' || :new.PACKAGE || '-' || :new.TARGET || '-' || :new.RESOURCENAME || '-' || :new.RESOURCEKIND);
ELSIF UPDATING THEN
MERGE INTO E1XL0.CODMETHODSRC d USING (SELECT 1 FROM dual)
ON (...)
WHEN MATCHED THEN UPDATE SET d.IMAGE = :new.IMAGE ...
WHEN NOT MATCHED THEN INSERT (d.VERSION,d.PACKAGE,d.TARGET,d.RESOURCENAME,d.RESOURCEKIND,d.IMAGE,d.LOCKED,d.CHG_DATE,d.CHG_USER,d.CHG_TYPE,d.ID) VALUES (:new.VERSION,:new.PACKAGE,:new.TARGET,:new.RESOURCENAME,:new.RESOURCEKIND,:new.IMAGE,:new.LOCKED,dteTimeStamp,NULL,strChgType,:new.VERSION || '-' || :new.PACKAGE || '-' || :new.TARGET || '-' || :new.RESOURCENAME || '-' || :new.RESOURCEKIND);
END IF; |
Partager