CREATE OR REPLACE TRIGGER DTULTATU_TPFIL
BEFORE INSERT OR UPDATE OR DELETE
ON TIPOOPERACFIL FOR EACH ROW

BEGIN
   IF INSERTING THEN
      :NEW.DTULTATU := SYSDATE;
   END IF;
   IF UPDATING THEN
      IF (NVL(:OLD.IDLIBERADO,0)   <> NVL(:NEW.IDLIBERADO,0))   OR
         (NVL(:OLD.IDLANCMANUAL,0) <> NVL(:NEW.IDLANCMANUAL,0)) THEN
         :NEW.DTULTATU := SYSDATE;
      END IF;
   END IF;
   IF DELETING THEN
      INSERT INTO DELETECACHE (NMTABLECACHE, CDFILICACHE, DSKEYCACHE, DTULTATUCACH)
                       VALUES ('TIPOOPERACFIL', '', 'IDENTRSAIDOP='||:OLD.IDENTRSAIDOP||';CDTIPOOPER='||:OLD.CDTIPOOPER||';', SYSDATE);
   END IF;
END;
/

ALTER TABLE TIPOOPERACFIL MODIFY DTULTATU DEFAULT SYSDATE
/