create or replace
TRIGGER DTULTATU_HABILOPER
BEFORE INSERT OR UPDATE OR DELETE
ON HABILOPER FOR EACH ROW

BEGIN
   IF INSERTING THEN
      :NEW.DTULTATUHAOP := SYSDATE;
   END IF;
   IF UPDATING THEN
      IF (NVL(:OLD.CDHABILIDADE,0)      <> NVL(:NEW.CDHABILIDADE,0)) OR
         (NVL(:OLD.CDOPERADOR,0)        <> NVL(:NEW.CDOPERADOR,0))   OR
         (NVL(:OLD.VRNIVHABILOP,0)      <> NVL(:NEW.VRNIVHABILOP,0)) OR
         (NVL(:OLD.VRCUSHRHABILOP,0)    <> NVL(:NEW.VRCUSHRHABILOP,0)) OR
         (NVL(:OLD.IDSITUACAOHABILOP,0) <> NVL(:NEW.IDSITUACAOHABILOP,0)) THEN
         :NEW.DTULTATUHAOP := SYSDATE;
      END IF;
   END IF;
   IF DELETING THEN
      INSERT INTO DELETECACHE (NMTABLECACHE, CDFILICACHE, DSKEYCACHE, DTULTATUCACH)
                       VALUES ('HABILOPER', '', 'CDOPERADOR='||:OLD.CDOPERADOR||';', SYSDATE);
   END IF;
END;
/

ALTER TABLE HABILOPER MODIFY DTULTATUHAOP DEFAULT SYSDATE
/