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

UPDATE SUGESTAOITEM SET DTULTATU = SYSDATE WHERE DTULTATU IS NULL
/

ALTER TABLE SUGESTAOITEM MODIFY DTULTATU DEFAULT SYSDATE
/

-- VERSAO --
BEGIN ATUVEROBJ('DTULTATU_SUGESTAOITEM','6.25.000'); END;
/