CREATE OR REPLACE TRIGGER DTULTATU_BASECALC
BEFORE INSERT OR DELETE OR UPDATE
ON BASECALC 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 ('BASECALC', '', 'CDIMPOSTO='||:OLD.CDIMPOSTO||';NRSEQUBCALC='||:OLD.NRSEQUBCALC||';', SYSDATE);
   END IF;
END;
/

UPDATE BASECALC SET DTULTATU = SYSDATE WHERE DTULTATU IS NULL
/

ALTER TABLE BASECALC MODIFY DTULTATU DEFAULT SYSDATE
/

-- VERSAO --
BEGIN ATUVEROBJ('DTULTATU_BASECALC','6.19.000'); END;
/