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

UPDATE SUGESTAOVENDA SET DTULTATU = SYSDATE WHERE DTULTATU IS NULL
/

ALTER TABLE SUGESTAOVENDA MODIFY DTULTATU DEFAULT SYSDATE
/

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