CREATE OR REPLACE TRIGGER DTULTATUGRFO_GRUPFORN
BEFORE INSERT OR UPDATE OR DELETE
ON GRUPFORN FOR EACH ROW

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

ALTER TABLE GRUPFORN MODIFY DTULTATUGRFO DEFAULT SYSDATE
/

-- VERSAO --
BEGIN ATUVEROBJ('DTULTATUGRFO_GRUPFORN','5.40.000'); END;
/          
