CREATE OR REPLACE TRIGGER DTULTATU_PARAMGPROC
BEFORE INSERT OR UPDATE OR DELETE
ON PARAMGPROC FOR EACH ROW

BEGIN
   IF INSERTING THEN
      :NEW.DTULTATUPARGPRO := SYSDATE;
   END IF;
   IF UPDATING THEN
      IF (NVL(:OLD.CDGRUPROCESSO,0) <> NVL(:NEW.CDGRUPROCESSO,0)) OR
         (NVL(:OLD.IDPARAMGPROC,0) <> NVL(:NEW.IDPARAMGPROC,0)) THEN
         :NEW.DTULTATUPARGPRO := SYSDATE;
      END IF;
   END IF;
   IF DELETING THEN
      INSERT INTO DELETECACHE (NMTABLECACHE, CDFILICACHE, DSKEYCACHE, DTULTATUCACH)
                       VALUES ('PARAMGPROC', '', 'CDGRUPROCESSO='||:OLD.CDGRUPROCESSO||';IDPARAMGPROC='||:OLD.IDPARAMGPROC||';', SYSDATE);
   END IF;
END;
/

ALTER TABLE PARAMGPROC MODIFY DTULTATUPARGPRO DEFAULT SYSDATE
/

-- VERSAO --
BEGIN ATUVEROBJ('DTULTATU_PARAMGPROC','5.01.033'); END;
/

