CREATE OR REPLACE TRIGGER DTULTATU_BASECALCTPOPER
BEFORE INSERT OR DELETE OR UPDATE
ON BASECALCTPOPER 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 ('BASECALCTPOPER', '', 'CDIMPOSTO='||:OLD.CDIMPOSTO||';NRSEQBCALTPOP='||:OLD.NRSEQBCALTPOP||';IDENTRSAIDOP='||
                                                     :OLD.IDENTRSAIDOP||';CDTIPOOPER='||:OLD.CDTIPOOPER||';', SYSDATE);
   END IF;
END;
/

UPDATE BASECALCTPOPER SET DTULTATU = SYSDATE WHERE DTULTATU IS NULL
/

ALTER TABLE BASECALCTPOPER MODIFY DTULTATU DEFAULT SYSDATE
/

-- VERSAO --
BEGIN ATUVEROBJ('DTULTATU_BASECALCTPOPER','6.29.XXX'); END;
/
