CREATE OR REPLACE TRIGGER DTULTATU_FERICARD
BEFORE INSERT OR DELETE OR UPDATE OF DSFERICARD
ON FERICARD 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 ('FERICARD', :OLD.CDFILIAL, 'CDFILIAL='||:OLD.CDFILIAL||';DTFERICARD='||TO_CHAR(:OLD.DTFERICARD,'YYYY-MM-DD HH24:MI:SS')||';', SYSDATE);
   END IF;
END;
/
UPDATE FERICARD SET DTULTATU = SYSDATE WHERE DTULTATU IS NULL
/
ALTER TABLE FERICARD MODIFY DTULTATU DEFAULT SYSDATE
/
-- VERSAO --
BEGIN ATUVEROBJ('DTULTATU_FERICARD','5.09.999'); END;
/
