/******************************************************************************/
/******************************************************************************/
/*                                                                            */
/* Trigger: DTULTATU_PRODOBRIGOCOR                                            */
/* Tabela : PRODOBRIGOCOR                                                     */
/*                                                                            */
/* Criação:                                                                   */
/*                                                                            */
/*                                                                            */
/******************************************************************************/

CREATE OR REPLACE TRIGGER DTULTATU_PRODOBRIGOCOR
BEFORE INSERT OR UPDATE OR DELETE
ON PRODOBRIGOCOR 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 ('PRODOBRIGOCOR', '', 'CDGRPOCOR='||:OLD.CDGRPOCOR||';CDGRUPOOBRIG='||:OLD.CDGRUPOOBRIG||';CDOCORR='||:OLD.CDOCORR||';', SYSDATE);
   
   END IF;
END;
/

ALTER TABLE PRODOBRIGOCOR MODIFY DTULTATU DEFAULT SYSDATE
/

-- VERSAO --
BEGIN ATUVEROBJ('DTULTATU_PRODOBRIGOCOR','6.19.001'); END;
/
