/* ************************************************************************************** */
/*                                                                                        */
/* Trigger: DTULTATU_RELACCODSSL                                                          */
/* Tabela : RELACCODSSL                                                                   */
/*                                                                                        */
/* Criação:                                                                               */
/* 15/10/2018 - Blayner Mendes                                                            */
/*                                                                                        */
/* ************************************************************************************** */

CREATE OR REPLACE TRIGGER DTULTATU_RELACCODSSL
BEFORE INSERT OR DELETE OR UPDATE
ON RELACCODSSL 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 ('RELACCODSSL', :OLD.CDFILIAL, 'IDSERIALDISP='||:OLD.IDSERIALDISP||';IDCODSSL='||:OLD.IDCODSSL||';CDFILIAL='||
					           :OLD.CDFILIAL||';CDCAIXA='||:OLD.CDCAIXA||';', SYSDATE);
   END IF;
END;
/

UPDATE RELACCODSSL SET DTULTATU = SYSDATE WHERE DTULTATU IS NULL
/

ALTER TABLE RELACCODSSL MODIFY DTULTATU DEFAULT SYSDATE
/

-- VERSAO --
BEGIN ATUVEROBJ('DTULTATU_RELACCODSSL','6.05.000'); END;
/