CREATE OR REPLACE TRIGGER DTULTATU_TABEVENDGER_CASCADE
BEFORE INSERT OR UPDATE OR DELETE
ON TABEVENDGER FOR EACH ROW

BEGIN
   IF INSERTING THEN
      :NEW.DTULTATU := SYSDATE;
   END IF;
   IF UPDATING THEN
      :NEW.DTULTATU := SYSDATE;
      UPDATE ITEMPRECOGER
         SET DTULTATU = SYSDATE
       WHERE CDTABEPREC = :OLD.CDTABEPREC
         AND DTINIVGPREC = :OLD.DTINIVGPREC;
   END IF;
   IF DELETING THEN
      INSERT INTO DELETECACHE (NMTABLECACHE, CDFILICACHE, DSKEYCACHE, DTULTATUCACH)
                       VALUES ('TABEVENDGER', NULL, 'CDTABEPREC='||:OLD.CDTABEPREC||';DTINIVGPREC='||TO_CHAR(:OLD.DTINIVGPREC,'YYYY-MM-DD HH24:MI:SS')||';', SYSDATE);
   END IF;
END;
/