/******************************************************************************/
/******************************************************************************/
/*                                                                            */
/* Trigger: DTULTATU_COLLAYOUTIMP                                             */
/* Tabela : COLLAYOUTIMP                                                      */
/*                                                                            */
/* Criação:                                                                   */
/* 09/05/2011 - CAIO ECKHARDT PASCHOAL                                        */
/*                                                                            */
/******************************************************************************/

CREATE OR REPLACE TRIGGER DTULTATU_COLLAYOUTIMP
BEFORE INSERT OR UPDATE OR DELETE
ON COLLAYOUTIMP FOR EACH ROW

BEGIN
   IF INSERTING THEN
      :NEW.DTULTATUCOLL := SYSDATE;
   END IF;

   IF UPDATING THEN
      :NEW.DTULTATUCOLL := SYSDATE;

   END IF;

   IF DELETING THEN
      INSERT INTO DELETECACHE (NMTABLECACHE, CDFILICACHE, DSKEYCACHE, DTULTATUCACH)
                       VALUES ('COLLAYOUTIMP', NULL, 'CDLAYOUTIMP='||:OLD.CDLAYOUTIMP||';NRSEQTABELAY='||:OLD.NRSEQTABELAY||';IDFUNARQLAY='||:OLD.IDFUNARQLAY||';NRSEQCOLULAY='||:OLD.NRSEQCOLULAY||';', SYSDATE);
   END IF;
END;
/

ALTER TABLE COLLAYOUTIMP MODIFY DTULTATUCOLL DEFAULT SYSDATE
/

UPDATE COLLAYOUTIMP SET DTULTATUCOLL = SYSDATE WHERE DTULTATUCOLL IS NULL
/

-- VERSAO --
BEGIN ATUVEROBJ('DTULTATU_COLLAYOUTIMP','5.20.000'); END;
/