CREATE OR REPLACE TRIGGER DTULTATU_CONSUMIFILIAL
BEFORE INSERT OR DELETE OR UPDATE
ON CONSUMIFILIAL FOR EACH ROW


BEGIN

   IF INSERTING THEN
      :NEW.DTULTATU := SYSDATE;
   END IF;
   IF UPDATING THEN
      :NEW.DTULTATU := SYSDATE;
   END IF;
   IF DELETING THEN
      INSERT INTO DELETECACHE (NMTABLECACHE, CDFILICACHE, DSKEYCACHE, DTULTATUCACH)
                       VALUES ('CONSUMIFILIAL', '', 'CDCLIENTE='||:OLD.CDCLIENTE||';CDCONSUMIDOR='||:OLD.CDCONSUMIDOR||';CDFILIAL='||:OLD.CDFILIAL||';', SYSDATE);
   END IF;
END;
/
UPDATE CONSUMIFILIAL SET DTULTATU = SYSDATE WHERE DTULTATU IS NULL
/
ALTER TABLE CONSUMIFILIAL MODIFY DTULTATU DEFAULT SYSDATE
/
-- VERSAO --
BEGIN ATUVEROBJ('DTULTATU_CONSUMIFILIAL','5.09.999'); END;
/
