/* Tabela CONSUMIDOR: TABELA DE CONSUMIDOR*/
/* Descrição: A trigger insere registros na tabela LOGOPERAVND a partir de alterações na tabela CONSUMIDOR */
/* Objetivo: Gerar um log que vai registrar as alterações na CONSUMIDOR,
             utilizando a tabela de Logs de Operações do VND*/
CREATE OR REPLACE TRIGGER LOG_VND_CONSUMIDOR
AFTER DELETE OR INSERT OR UPDATE
ON CONSUMIDOR FOR EACH ROW
DECLARE
  V_DSREMOTEADDR VARCHAR2(15);
  V_DSREMOTEHOST VARCHAR2(15);
  V_DSSERVERRDM  VARCHAR2(20);
  V_DSSERVMETHOD VARCHAR2(30);
  V_DSREMOTEOPER VARCHAR2(12);
  V_DESC         VARCHAR2(3000);
  V_ITPESQ       VARCHAR2(50);
  V_NMOPERADOR   VARCHAR2(40);
  V_IDTIPOOPER   VARCHAR2(1);
BEGIN
/* IDTIPOOPER - '1' - Inclusão, '2' - Alteração, '3' - Exclusão*/
   V_DESC       := '';
   V_ITPESQ     := '';
   V_NMOPERADOR := '';
   V_IDTIPOOPER := '';
   NMUSUARIO(V_NMOPERADOR);
   WEBTUNNING(V_DSREMOTEADDR,
              V_DSREMOTEHOST,
              V_DSSERVERRDM,
              V_DSSERVMETHOD,
              V_DSREMOTEOPER);
   IF UPDATING THEN
      IF NVL(:NEW.CDCLIENTE,'NULL') <> NVL(:OLD.CDCLIENTE,'NULL') THEN 
         V_DESC := 'Cd Clie ' || '' || NVL(:NEW.CDCLIENTE,'' );
      END IF;
      IF NVL(:NEW.CDCONSUMIDOR,'NULL') <> NVL(:OLD.CDCONSUMIDOR,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Cd Cons ' || '' || NVL(:NEW.CDCONSUMIDOR,'' );
      END IF;
      IF NVL(:NEW.NMCONSUMIDOR,'NULL') <> NVL(:OLD.NMCONSUMIDOR,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Nm Cons ' || '' || NVL(:NEW.NMCONSUMIDOR,'' );
      END IF;
      IF NVL(:NEW.VRLIMDEBCONS,999999) <> NVL(:OLD.VRLIMDEBCONS,999999) THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Vr Lim Deb ' || '' || NVL(:NEW.VRLIMDEBCONS,'' );
      END IF;
      IF NVL(:NEW.IDSITCONSUMI,'NULL') <> NVL(:OLD.IDSITCONSUMI,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Id Sit Cons ' || '' || NVL(:NEW.IDSITCONSUMI,'' );
      END IF;
      IF NVL(:NEW.CDPAIS,'NULL') <> NVL(:OLD.CDPAIS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Cd Pais ' || '' || NVL(:NEW.CDPAIS,'' );
      END IF;
      IF NVL(:NEW.SGESTADO,'NULL') <> NVL(:OLD.SGESTADO,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Sg Estado ' || '' || NVL(:NEW.SGESTADO,'' );
      END IF;
      IF NVL(:NEW.CDMUNICIPIO,'NULL') <> NVL(:OLD.CDMUNICIPIO,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Cd Municipo ' || '' || NVL(:NEW.CDMUNICIPIO,'' );
      END IF;
      IF NVL(:NEW.CDTIPOCONS,'NULL') <> NVL(:OLD.CDTIPOCONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Cd Tp Cons ' || '' || NVL(:NEW.CDTIPOCONS,'' );
      END IF;
      IF NVL(:NEW.CDCCUSCLIE,'NULL') <> NVL(:OLD.CDCCUSCLIE,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Cd Custo Clie ' || '' || NVL(:NEW.CDCCUSCLIE,'' );
      END IF;
      IF NVL(:NEW.VRAVIDEBCONS,999999) <> NVL(:OLD.VRAVIDEBCONS,999999) THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Vr Avi Deb' || '' || NVL(:NEW.VRAVIDEBCONS,'' );
      END IF;
      IF NVL(:NEW.CDIDCONSUMID,'NULL') <> NVL(:OLD.CDIDCONSUMID,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Cd Id Cons ' || '' || NVL(:NEW.CDIDCONSUMID,'' );
      END IF;
      IF NVL(:NEW.CDEXCONSUMID,'NULL') <> NVL(:OLD.CDEXCONSUMID,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Cd Ex Cons ' || '' || NVL(:NEW.CDEXCONSUMID,'' );
      END IF;
      IF NVL(:NEW.DSENDECONS,'NULL') <> NVL(:OLD.DSENDECONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' End Cons ' || '' || NVL(:NEW.DSENDECONS,'' );
      END IF;
      IF NVL(:NEW.NMBAIRCONS,'NULL') <> NVL(:OLD.NMBAIRCONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Bairro ' || '' || NVL(:NEW.NMBAIRCONS,'' );
      END IF;
      IF NVL(:NEW.NRCEPCONS,'NULL') <> NVL(:OLD.NRCEPCONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Cep' || '' || NVL(:NEW.NRCEPCONS,'' );
      END IF;
      IF NVL(:NEW.NRTELECONS,'NULL') <> NVL(:OLD.NRTELECONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Tel ' || '' || NVL(:NEW.NRTELECONS,'' );
      END IF;
      IF NVL(:NEW.NRRAMAL1CONS,'NULL') <> NVL(:OLD.NRRAMAL1CONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Ramal ' || '' || NVL(:NEW.NRRAMAL1CONS,'' );
      END IF;
      IF NVL(:NEW.NRTELE2CONS,'NULL') <> NVL(:OLD.NRTELE2CONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Tel2 ' || '' || NVL(:NEW.NRTELE2CONS,'' );
      END IF;
      IF NVL(:NEW.NRRAMAL2CONS,'NULL') <> NVL(:OLD.NRRAMAL2CONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Ramal2 ' || '' || NVL(:NEW.NRRAMAL2CONS,'' );
      END IF;
      IF NVL(:NEW.NRFAXCONS,'NULL') <> NVL(:OLD.NRFAXCONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Fax ' || '' || NVL(:NEW.NRFAXCONS,'' );
      END IF;
      IF NVL(:NEW.DSEMAILCONS,'NULL') <> NVL(:OLD.DSEMAILCONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Email ' || '' || NVL(:NEW.DSEMAILCONS,'' );
      END IF;
      IF NVL(:NEW.IDVERSALDCON,'NULL') <> NVL(:OLD.IDVERSALDCON,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Id Sald Neg ' || '' || NVL(:NEW.IDVERSALDCON,'' );
      END IF;
      IF NVL(:NEW.VRMESUBCONS,999999) <> NVL(:OLD.VRMESUBCONS,999999) THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Vr Méd Sub ' || '' || NVL(:NEW.VRMESUBCONS,'' );
      END IF;
      IF NVL(:NEW.VRPESUBCONS,999999) <> NVL(:OLD.VRPESUBCONS,999999) THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Vr Per Sub ' || '' || NVL(:NEW.VRPESUBCONS,'' );
      END IF;
      IF NVL(:NEW.CDREGRACONS,'NULL') <> NVL(:OLD.CDREGRACONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Cd Rg Consumo ' || '' || NVL(:NEW.CDREGRACONS,'' );
      END IF;
      IF NVL(:NEW.QTACECATCONS,999999) <> NVL(:OLD.QTACECATCONS,999999) THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Qt Ace Cat ' || '' || NVL(:NEW.QTACECATCONS,'' );
      END IF;
      IF NVL(:NEW.DTULTMOVCONS,TO_DATE('01/01/0001','DD/MM/YYYY')) <> NVL(:OLD.DTULTMOVCONS,TO_DATE('01/01/0001','DD/MM/YYYY')) THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Dt Ult Mov ' || '' || NVL(:NEW.DTULTMOVCONS,'' );
      END IF;
      IF NVL(:NEW.NRCTACORCONS,'NULL') <> NVL(:OLD.NRCTACORCONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Nr Cta ' || '' || NVL(:NEW.NRCTACORCONS,'' );
      END IF;
      IF NVL(:NEW.IDCONSUMIDOR,'NULL') <> NVL(:OLD.IDCONSUMIDOR,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Id Cons ' || '' || NVL(:NEW.IDCONSUMIDOR,'' );
      END IF;
      IF NVL(:NEW.CDVENDEDOR,'NULL') <> NVL(:OLD.CDVENDEDOR,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Cd Vendedor ' || '' || NVL(:NEW.CDVENDEDOR,'' );
      END IF;
      IF NVL(:NEW.DTULTATUCSUM,TO_DATE('01/01/0001','DD/MM/YYYY')) <> NVL(:OLD.DTULTATUCSUM,TO_DATE('01/01/0001','DD/MM/YYYY')) THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Dt Ult Atu ' || '' || NVL(:NEW.DTULTATUCSUM,'' );
      END IF;
      IF NVL(:NEW.NRRGCONSUMID,'NULL') <> NVL(:OLD.NRRGCONSUMID,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Rg ' || '' || NVL(:NEW.NRRGCONSUMID,'' );
      END IF;
      IF NVL(:NEW.IDATUCONSUMI,'NULL') <> NVL(:OLD.IDATUCONSUMI,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Id Atu ' || '' || NVL(:NEW.IDATUCONSUMI,'' );
      END IF;
      IF NVL(:NEW.CDSENHACONS,'NULL') <> NVL(:OLD.CDSENHACONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Senha ' || '' || NVL(:NEW.CDSENHACONS,'' );
      END IF;
      IF NVL(:NEW.NRCPFRESPCON,'NULL') <> NVL(:OLD.NRCPFRESPCON,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Cpf Resp ' || '' || NVL(:NEW.NRCPFRESPCON,'' );
      END IF;
      IF NVL(:NEW.NMRESPCONS,'NULL') <> NVL(:OLD.NMRESPCONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Nr Resp ' || '' || NVL(:NEW.NMRESPCONS,'' );
      END IF;
      IF NVL(:NEW.NMLOGINCONS,'NULL') <> NVL(:OLD.NMLOGINCONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Login ' || '' || NVL(:NEW.NMLOGINCONS,'' );
      END IF;
      IF NVL(:NEW.DSINFOCONS,'NULL') <> NVL(:OLD.DSINFOCONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Info ' || '' || NVL(:NEW.DSINFOCONS,'' );
      END IF;
      IF NVL(:NEW.IDSEXOCONS,'NULL') <> NVL(:OLD.IDSEXOCONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Sexo ' || '' || NVL(:NEW.IDSEXOCONS,'' );
      END IF;
      IF NVL(:NEW.DTNASCCONS,TO_DATE('01/01/0001','DD/MM/YYYY')) <> NVL(:OLD.DTNASCCONS,TO_DATE('01/01/0001','DD/MM/YYYY')) THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Dt Nasc ' || '' || NVL(:NEW.DTNASCCONS,'' );
      END IF;
      IF NVL(:NEW.VRMAXDEBCONS,999999) <> NVL(:OLD.VRMAXDEBCONS,999999) THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Vr Max Deb ' || '' || NVL(:NEW.VRMAXDEBCONS,'' );
      END IF;
      IF NVL(:NEW.VRLIMCREDCONS,999999) <> NVL(:OLD.VRLIMCREDCONS,999999) THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Vr Lim Cred ' || '' || NVL(:NEW.VRLIMCREDCONS,'' );
      END IF;
      IF NVL(:NEW.VRAVICREDCONS,999999) <> NVL(:OLD.VRAVICREDCONS,999999) THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Vr Avi Cred ' || '' || NVL(:NEW.VRAVICREDCONS,'' );
      END IF;
      IF NVL(:NEW.VRMAXCREDCONS,999999) <> NVL(:OLD.VRMAXCREDCONS,999999) THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Vr Max Cred ' || '' || NVL(:NEW.VRMAXCREDCONS,'' );
      END IF;
      IF NVL(:NEW.CDSENHASITE,'NULL') <> NVL(:OLD.CDSENHASITE,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Senha Resp ' || '' || NVL(:NEW.CDSENHASITE,'' );
      END IF;
      IF NVL(:NEW.VRDIASUBCONS,999999) <> NVL(:OLD.VRDIASUBCONS,999999) THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Vr Consumo Dia ' || '' || NVL(:NEW.VRDIASUBCONS,'' );
      END IF;
      IF NVL(:NEW.NRACESSOSITE,999999) <> NVL(:OLD.NRACESSOSITE,999999) THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Nr Acesso Site ' || '' || NVL(:NEW.NRACESSOSITE,'' );
      END IF;
      IF NVL(:NEW.DSCOMPLENDECONS,'NULL') <> NVL(:OLD.DSCOMPLENDECONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Ds Compl End Cons ' || '' || NVL(:NEW.DSCOMPLENDECONS,'' );
      END IF;
      IF NVL(:NEW.DSREFERENDECONS,'NULL') <> NVL(:OLD.DSREFERENDECONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Ds Refer End Cons ' || '' || NVL(:NEW.DSREFERENDECONS,'' );
      END IF;
      IF NVL(:NEW.NRCELULARCONS,'NULL') <> NVL(:OLD.NRCELULARCONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Cel Cons ' || '' || NVL(:NEW.NRCELULARCONS,'' );
      END IF;
      IF NVL(:NEW.CDBAIRRO,'NULL') <> NVL(:OLD.CDBAIRRO,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Cd Bairro ' || '' || NVL(:NEW.CDBAIRRO,'' );
      END IF;
      IF NVL(:NEW.IDTPVENDACONS,'NULL') <> NVL(:OLD.IDTPVENDACONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Id Tp Venda ' || '' || NVL(:NEW.IDTPVENDACONS,'' );
      END IF;
      IF NVL(:NEW.IDIMPCPFCUPOM,'NULL') <> NVL(:OLD.IDIMPCPFCUPOM,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Imp Cpf Cupom ' || '' || NVL(:NEW.IDIMPCPFCUPOM,'' );
      END IF;
      IF NVL(:NEW.IDCADCONFLIBCON,'NULL') <> NVL(:OLD.IDCADCONFLIBCON,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Cad Conf lib ' || '' || NVL(:NEW.IDCADCONFLIBCON,'' );
      END IF;
      IF NVL(:NEW.IDPERCONSPRODEX,'NULL') <> NVL(:OLD.IDPERCONSPRODEX,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Per Consumo Ex ' || '' || NVL(:NEW.IDPERCONSPRODEX,'' );
      END IF;
      IF NVL(:NEW.NRENDECONS,'NULL') <> NVL(:OLD.NRENDECONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' End Cons ' || '' || NVL(:NEW.NRENDECONS,'' );
      END IF;
      IF NVL(:NEW.IDCRACHAMESTRE,'NULL') <> NVL(:OLD.IDCRACHAMESTRE,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Cracha Mestre ' || '' || NVL(:NEW.IDCRACHAMESTRE,'' );
      END IF;
      IF NVL(:NEW.IDTPSELMANHA,'NULL') <> NVL(:OLD.IDTPSELMANHA,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Lanche Manha ' || '' || NVL(:NEW.IDTPSELMANHA, '' );
      END IF;
      IF NVL(:NEW.IDTPSEALMOCO,'NULL') <> NVL(:OLD.IDTPSEALMOCO,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Almoco ' || '' || NVL(:NEW.IDTPSEALMOCO, '' );
      END IF;
      IF NVL(:NEW.IDTPSELTARDE,'NULL') <> NVL(:OLD.IDTPSELTARDE,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Lanche Tarde ' || '' || NVL(:NEW.IDTPSELTARDE, '' );
      END IF;
      IF NVL(:NEW.IDATUCPFCONS,'NULL') <> NVL(:OLD.IDATUCPFCONS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Atualiza CPF na Venda ' || '' || NVL(:NEW.IDATUCPFCONS, '' );
      END IF;
      IF NVL(:NEW.CDCONSVINCULO,'NULL') <> NVL(:OLD.CDCONSVINCULO,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Cons Vinculo ' || '' || NVL(:NEW.CDCONSVINCULO, '' );
      END IF;
      IF NVL(:NEW.NMQUADRANTE,'NULL') <> NVL(:OLD.NMQUADRANTE,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Quadrante ' || '' || NVL(:NEW.NMQUADRANTE, '' );
      END IF;
      IF NVL(:NEW.VRSUBSBASICO,999999) <> NVL(:OLD.VRSUBSBASICO,999999) THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Valor Sub. Basico ' || '' || NVL(:NEW.VRSUBSBASICO, '' );
      END IF;
      IF NVL(:NEW.VRMAXCONSMENSAL,999999) <> NVL(:OLD.VRMAXCONSMENSAL,999999) THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Valor Max Cons Mensal ' || '' || NVL(:NEW.VRMAXCONSMENSAL, '' );
      END IF;
      IF NVL(:NEW.IDBLOQSALDFS,'NULL') <> NVL(:OLD.IDBLOQSALDFS,'NULL') THEN
         V_DESC := NVL(V_DESC, '') || '' || ' Bloq Ut Saldo Fim Sem ' || '' || NVL(:NEW.IDBLOQSALDFS, '' );
      END IF;

      V_ITPESQ := :NEW.CDCLIENTE||:NEW.CDCONSUMIDOR;
      V_IDTIPOOPER := '2';
   ELSE
      IF INSERTING THEN
         IF :NEW.CDCLIENTE IS NOT NULL THEN
            V_DESC := ' ' || ' Cd Clie' || NVL(:NEW.CDCLIENTE,'' );
         END IF;
         IF :NEW.CDCONSUMIDOR IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Cd Cons ' || '' || NVL(:NEW.CDCONSUMIDOR,'' );
         END IF;
         IF :NEW.NMCONSUMIDOR IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Nm Cons ' || '' || NVL(:NEW.NMCONSUMIDOR,'' );
         END IF;
         IF :NEW.VRLIMDEBCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Vr Lim Deb ' || '' || NVL(:NEW.VRLIMDEBCONS,'' );
         END IF;
         IF :NEW.IDSITCONSUMI IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Id Sit Cons ' || '' || NVL(:NEW.IDSITCONSUMI,'' );
         END IF;
         IF :NEW.CDPAIS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Cd Pais ' || '' || NVL(:NEW.CDPAIS,'' );
         END IF;
         IF :NEW.SGESTADO IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Sg Estado ' || '' || NVL(:NEW.SGESTADO,'' );
         END IF;
         IF :NEW.CDMUNICIPIO IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Cd Municipo ' || '' || NVL(:NEW.CDMUNICIPIO,'' );
         END IF;
         IF :NEW.CDTIPOCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Cd Tp Cons ' || '' || NVL(:NEW.CDTIPOCONS,'' );
         END IF;
         IF :NEW.CDCCUSCLIE IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Cd Custo Clie ' || '' || NVL(:NEW.CDCCUSCLIE,'' );
         END IF;
         IF :NEW.VRAVIDEBCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Vr Avi Deb ' || '' || NVL(:NEW.VRAVIDEBCONS,'' );
         END IF;
         IF :NEW.CDIDCONSUMID IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Cd Id Cons ' || '' || NVL(:NEW.CDIDCONSUMID,'' );
         END IF;
         IF :NEW.CDEXCONSUMID IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Cd Ex Cons ' || '' || NVL(:NEW.CDEXCONSUMID,'' );
         END IF;
         IF :NEW.DSENDECONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' End Cons ' || '' || NVL(:NEW.DSENDECONS,'' );
         END IF;
         IF :NEW.NMBAIRCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Bairro ' || '' || NVL(:NEW.NMBAIRCONS,'' );
         END IF;
         IF :NEW.NRCEPCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Cep ' || '' || NVL(:NEW.NRCEPCONS,'' );
         END IF;
         IF :NEW.NRTELECONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Tel ' || '' || NVL(:NEW.NRTELECONS,'' );
         END IF;
         IF :NEW.NRRAMAL1CONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Ramal ' || '' || NVL(:NEW.NRRAMAL1CONS,'' );
         END IF;
         IF :NEW.NRTELE2CONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Tel2 ' || '' || NVL(:NEW.NRTELE2CONS,'' );
         END IF;
         IF :NEW.NRRAMAL2CONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Ramal2 ' || '' || NVL(:NEW.NRRAMAL2CONS,'' );
         END IF;
         IF :NEW.NRFAXCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Fax ' || '' || NVL(:NEW.NRFAXCONS,'' );
         END IF;
         IF :NEW.DSEMAILCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Email ' || '' || NVL(:NEW.DSEMAILCONS,'' );
         END IF;
         IF :NEW.IDVERSALDCON IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Id Sald Neg ' || '' || NVL(:NEW.IDVERSALDCON,'' );
         END IF;
         IF :NEW.VRMESUBCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Vr Méd Sub ' || '' || NVL(:NEW.VRMESUBCONS,'' );
         END IF;
         IF :NEW.VRPESUBCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Vr Per Sub ' || '' || NVL(:NEW.VRPESUBCONS,'' );
         END IF;
         IF :NEW.CDREGRACONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Cd Rg Consumo ' || '' || NVL(:NEW.CDREGRACONS,'' );
         END IF;
         IF :NEW.QTACECATCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Qt Ace Cat ' || '' || NVL(:NEW.QTACECATCONS,'' );
         END IF;
         IF :NEW.DTULTMOVCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Dt Ult Mov ' || '' || NVL(:NEW.DTULTMOVCONS,'' );
         END IF;
         IF :NEW.NRCTACORCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Nr Cta ' || '' || NVL(:NEW.NRCTACORCONS,'' );
         END IF;
         IF :NEW.IDCONSUMIDOR IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Id Cons ' || '' || NVL(:NEW.IDCONSUMIDOR,'' );
         END IF;
         IF :NEW.CDVENDEDOR IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Cd Vendedor ' || '' || NVL(:NEW.CDVENDEDOR,'' );
         END IF;
         IF :NEW.DTULTATUCSUM IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Dt Ult Atu ' || '' || NVL(:NEW.DTULTATUCSUM,'' );
         END IF;
         IF :NEW.NRRGCONSUMID IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Rg ' || '' || NVL(:NEW.NRRGCONSUMID,'' );
         END IF;
         IF :NEW.IDATUCONSUMI IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Id Atu ' || '' || NVL(:NEW.IDATUCONSUMI,'' );
         END IF;
         IF :NEW.CDSENHACONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Senha ' || '' || NVL(:NEW.CDSENHACONS,'' );
         END IF;
         IF :NEW.NRCPFRESPCON IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Cpf Resp ' || '' || NVL(:NEW.NRCPFRESPCON,'' );
         END IF;
         IF :NEW.NMRESPCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Nr Resp ' || '' || NVL(:NEW.NMRESPCONS,'' );
         END IF;
         IF :NEW.NMLOGINCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Login ' || '' || NVL(:NEW.NMLOGINCONS,'' );
         END IF;
         IF :NEW.DSINFOCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Info ' || '' || NVL(:NEW.DSINFOCONS,'' );
         END IF;
         IF :NEW.IDSEXOCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Sexo ' || '' || NVL(:NEW.IDSEXOCONS,'' );
         END IF;
         IF :NEW.DTNASCCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Dt Nasc ' || '' || NVL(:NEW.DTNASCCONS,'' );
         END IF;
         IF :NEW.VRMAXDEBCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Vr Max Deb ' || '' || NVL(:NEW.VRMAXDEBCONS,'' );
         END IF;
         IF :NEW.VRLIMCREDCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Vr Lim Cred ' || '' || NVL(:NEW.VRLIMCREDCONS,'' );
         END IF;
         IF :NEW.VRAVICREDCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Vr Avi Cred ' || '' || NVL(:NEW.VRAVICREDCONS,'' );
         END IF;
         IF :NEW.VRMAXCREDCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Vr Max Cred ' || '' || NVL(:NEW.VRMAXCREDCONS,'' );
         END IF;
         IF :NEW.CDSENHASITE IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Senha Resp ' || '' || NVL(:NEW.CDSENHASITE,'' );
         END IF;
         IF :NEW.VRDIASUBCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Vr Consumo Dia  ' || '' || NVL(:NEW.VRDIASUBCONS,'' );
         END IF;
         IF :NEW.NRACESSOSITE IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Nr Acesso Site ' || '' || NVL(:NEW.NRACESSOSITE,'' );
         END IF;
         IF :NEW.DSCOMPLENDECONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Ds Compl End Cons ' || '' || NVL(:NEW.DSCOMPLENDECONS,'' );
         END IF;
         IF :NEW.DSREFERENDECONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Ds Refer End Cons ' || '' || NVL(:NEW.DSREFERENDECONS,'' );
         END IF;
         IF :NEW.NRCELULARCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Cel Cons ' || '' || NVL(:NEW.NRCELULARCONS,'' );
         END IF;
         IF :NEW.CDBAIRRO IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Cd Bairro ' || '' || NVL(:NEW.CDBAIRRO,'' );
         END IF;
         IF :NEW.IDTPVENDACONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Id Tp Venda ' || '' || NVL(:NEW.IDTPVENDACONS,'' );
         END IF;
         IF :NEW.IDIMPCPFCUPOM IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Imp Cpf Cupom ' || '' || NVL(:NEW.IDIMPCPFCUPOM,'' );
         END IF;
         IF :NEW.IDCADCONFLIBCON IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Cad Conf lib ' || '' || NVL(:NEW.IDCADCONFLIBCON,'' );
         END IF;
         IF :NEW.IDPERCONSPRODEX IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Per Consumo Ex ' || '' || NVL(:NEW.IDPERCONSPRODEX,'' );
         END IF;
         IF :NEW.NRENDECONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' End Cons ' || '' || NVL(:NEW.NRENDECONS,'' );
         END IF;
         IF :NEW.IDCRACHAMESTRE IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Cracha Mestre ' || '' || NVL(:NEW.IDCRACHAMESTRE,'' );
         END IF;
         IF :NEW.IDTPSELMANHA IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Lanche Manha ' || '' || NVL(:NEW.IDTPSELMANHA,'' );
         END IF;
         IF :NEW.IDTPSEALMOCO IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Almoco ' || '' || NVL(:NEW.IDTPSEALMOCO,'' );
         END IF;
         IF :NEW.IDTPSELTARDE IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Lanche Tarde ' || '' || NVL(:NEW.IDTPSELTARDE,'' );
         END IF;
         IF :NEW.IDATUCPFCONS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Atualiza CPF na Venda ' || '' || NVL(:NEW.IDATUCPFCONS,'' );
         END IF;
         IF :NEW.CDCONSVINCULO IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Cons Vinculo ' || '' || NVL(:NEW.CDCONSVINCULO,'' );
         END IF;
         IF :NEW.CDMUNICIPIO IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Municipio ' || '' || NVL(:NEW.CDMUNICIPIO,'' );
         END IF;
         IF :NEW.NMQUADRANTE IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Quadrante ' || '' || NVL(:NEW.NMQUADRANTE, '' );
         END IF;
         IF :NEW.VRSUBSBASICO IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Valor Sub Basico ' || '' || NVL(:NEW.VRSUBSBASICO, '' );
         END IF;
         IF :NEW.VRMAXCONSMENSAL IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Valor Max Cons Mensal ' || '' || NVL(:NEW.VRMAXCONSMENSAL, '' );
         END IF;
         IF :NEW.IDBLOQSALDFS IS NOT NULL THEN
            V_DESC := NVL(V_DESC, '') || '' || ' Bloq Ut Saldo Fim Sem ' || '' || NVL(:NEW.IDBLOQSALDFS, '' );
         END IF;

         V_ITPESQ := :NEW.CDCLIENTE||:NEW.CDCONSUMIDOR;
         V_IDTIPOOPER := '1';
      ELSE
         IF DELETING THEN
            IF :OLD.CDCLIENTE IS NOT NULL THEN
               V_DESC := ' ' || ' Cd Clie ' || NVL(:OLD.CDCLIENTE,'' );
            END IF;
            IF :OLD.CDCONSUMIDOR IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Cd Cons ' || '' || NVL(:OLD.CDCONSUMIDOR,'' );
            END IF;
            IF :OLD.NMCONSUMIDOR IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Nm Cons ' || '' || NVL(:OLD.NMCONSUMIDOR,'' );
            END IF;
            IF :OLD.VRLIMDEBCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Vr Lim Deb ' || '' || NVL(:OLD.VRLIMDEBCONS,'' );
            END IF;
            IF :OLD.IDSITCONSUMI IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Id Sit Cons ' || '' || NVL(:OLD.IDSITCONSUMI,'' );
            END IF;
            IF :OLD.CDPAIS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Cd Pais ' || '' || NVL(:OLD.CDPAIS,'' );
            END IF;
            IF :OLD.SGESTADO IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Sg Estado ' || '' || NVL(:OLD.SGESTADO,'' );
            END IF;
            IF :OLD.CDMUNICIPIO IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Cd Municipo ' || '' || NVL(:OLD.CDMUNICIPIO,'' );
            END IF;
            IF :OLD.CDTIPOCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Cd Tp Cons ' || '' || NVL(:OLD.CDTIPOCONS,'' );
            END IF;
            IF :OLD.CDCCUSCLIE IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Cd Custo Clie ' || '' || NVL(:OLD.CDCCUSCLIE,'' );
            END IF;
            IF :OLD.VRAVIDEBCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Vr Avi Deb ' || '' || NVL(:OLD.VRAVIDEBCONS,'' );
            END IF;
            IF :OLD.CDIDCONSUMID IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Cd Id Cons ' || '' || NVL(:OLD.CDIDCONSUMID,'' );
            END IF;
            IF :OLD.CDEXCONSUMID IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Cd Ex Cons ' || '' || NVL(:OLD.CDEXCONSUMID,'' );
            END IF;
            IF :OLD.DSENDECONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' End Cons ' || '' || NVL(:OLD.DSENDECONS,'' );
            END IF;
            IF :OLD.NMBAIRCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Bairro ' || '' || NVL(:OLD.NMBAIRCONS,'' );
            END IF;
            IF :OLD.NRCEPCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Cep ' || '' || NVL(:OLD.NRCEPCONS,'' );
            END IF;
            IF :OLD.NRTELECONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Tel ' || '' || NVL(:OLD.NRTELECONS,'' );
            END IF;
            IF :OLD.NRRAMAL1CONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Ramal ' || '' || NVL(:OLD.NRRAMAL1CONS,'' );
            END IF;
            IF :OLD.NRTELE2CONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Tel2 ' || '' || NVL(:OLD.NRTELE2CONS,'' );
            END IF;
            IF :OLD.NRRAMAL2CONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Ramal2 ' || '' || NVL(:OLD.NRRAMAL2CONS,'' );
            END IF;
            IF :OLD.NRFAXCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Fax ' || '' || NVL(:OLD.NRFAXCONS,'' );
            END IF;
            IF :OLD.DSEMAILCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Email ' || '' || NVL(:OLD.DSEMAILCONS,'' );
            END IF;
            IF :OLD.IDVERSALDCON IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Id Sald Neg ' || '' || NVL(:OLD.IDVERSALDCON,'' );
            END IF;
            IF :OLD.VRMESUBCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Vr Méd Sub ' || '' || NVL(:OLD.VRMESUBCONS,'' );
            END IF;
            IF :OLD.VRPESUBCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Vr Per Sub ' || '' || NVL(:OLD.VRPESUBCONS,'' );
            END IF;
            IF :OLD.CDREGRACONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Cd Rg Consumo ' || '' || NVL(:OLD.CDREGRACONS,'' );
            END IF;
            IF :OLD.QTACECATCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Qt Ace Cat ' || '' || NVL(:OLD.QTACECATCONS,'' );
            END IF;
            IF :OLD.DTULTMOVCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Dt Ult Mov ' || '' || NVL(:OLD.DTULTMOVCONS,'' );
            END IF;
            IF :OLD.NRCTACORCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Nr Cta ' || '' || NVL(:OLD.NRCTACORCONS,'' );
            END IF;
            IF :OLD.IDCONSUMIDOR IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Id Cons ' || '' || NVL(:OLD.IDCONSUMIDOR,'' );
            END IF;
            IF :OLD.CDVENDEDOR IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Cd Vendedor ' || '' || NVL(:OLD.CDVENDEDOR,'' );
            END IF;
            IF :OLD.DTULTATUCSUM IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Dt Ult Atu ' || '' || NVL(:OLD.DTULTATUCSUM,'' );
            END IF;
            IF :OLD.NRRGCONSUMID IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Rg ' || '' || NVL(:OLD.NRRGCONSUMID,'' );
            END IF;
            IF :OLD.IDATUCONSUMI IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Id Atu ' || '' || NVL(:OLD.IDATUCONSUMI,'' );
            END IF;
            IF :OLD.CDSENHACONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Senha ' || '' || NVL(:OLD.CDSENHACONS,'' );
            END IF;
            IF :OLD.NRCPFRESPCON IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Cpf Resp ' || '' || NVL(:OLD.NRCPFRESPCON,'' );
            END IF;
            IF :OLD.NMRESPCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Nr Resp ' || '' || NVL(:OLD.NMRESPCONS,'' );
            END IF;
            IF :OLD.NMLOGINCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Login ' || '' || NVL(:OLD.NMLOGINCONS,'' );
            END IF;
            IF :OLD.DSINFOCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Info ' || '' || NVL(:OLD.DSINFOCONS,'' );
            END IF;
            IF :OLD.IDSEXOCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Sexo ' || '' || NVL(:OLD.IDSEXOCONS,'' );
            END IF;
            IF :OLD.DTNASCCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Dt Nasc ' || '' || NVL(:OLD.DTNASCCONS,'' );
            END IF;
            IF :OLD.VRMAXDEBCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Vr Max Deb ' || '' || NVL(:OLD.VRMAXDEBCONS,'' );
            END IF;
            IF :OLD.VRLIMCREDCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Vr Lim Cred ' || '' || NVL(:OLD.VRLIMCREDCONS,'' );
            END IF;
            IF :OLD.VRAVICREDCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Vr Avi Cred ' || '' || NVL(:OLD.VRAVICREDCONS,'' );
            END IF;
            IF :OLD.VRMAXCREDCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Vr Max Cred ' || '' || NVL(:OLD.VRMAXCREDCONS,'' );
            END IF;
            IF :OLD.CDSENHASITE IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Senha Resp ' || '' || NVL(:OLD.CDSENHASITE,'' );
            END IF;
            IF :OLD.VRDIASUBCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Vr Consumo Dia  ' || '' || NVL(:OLD.VRDIASUBCONS,'' );
            END IF;
            IF :OLD.NRACESSOSITE IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Nr Acesso Site ' || '' || NVL(:OLD.NRACESSOSITE,'' );
            END IF;
            IF :OLD.DSCOMPLENDECONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Ds Compl End Cons ' || '' || NVL(:OLD.DSCOMPLENDECONS,'' );
            END IF;
            IF :OLD.DSREFERENDECONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Ds Refer End Cons ' || '' || NVL(:OLD.DSREFERENDECONS,'' );
            END IF;
            IF :OLD.NRCELULARCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Cel Cons ' || '' || NVL(:OLD.NRCELULARCONS,'' );
            END IF;
            IF :OLD.CDBAIRRO IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Cd Bairro ' || '' || NVL(:OLD.CDBAIRRO,'' );
            END IF;
            IF :OLD.IDTPVENDACONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Id Tp Venda ' || '' || NVL(:OLD.IDTPVENDACONS,'' );
            END IF;
            IF :OLD.IDIMPCPFCUPOM IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Imp Cpf Cupom ' || '' || NVL(:OLD.IDIMPCPFCUPOM,'' );
            END IF;
            IF :OLD.IDCADCONFLIBCON IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Cad Conf lib ' || '' || NVL(:OLD.IDCADCONFLIBCON,'' );
            END IF;
            IF :OLD.IDPERCONSPRODEX IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Per Consumo Ex ' || '' || NVL(:OLD.IDPERCONSPRODEX,'' );
            END IF;
            IF :OLD.NRENDECONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' End Cons ' || '' || NVL(:OLD.NRENDECONS,'' );
            END IF;
            IF :OLD.IDCRACHAMESTRE IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Cracha Mestre ' || '' || NVL(:OLD.IDCRACHAMESTRE,'' );
            END IF;
            IF :OLD.IDTPSELMANHA IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Lanche Manha ' || '' || NVL(:OLD.IDTPSELMANHA,'' );
            END IF;
            IF :OLD.IDTPSEALMOCO IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Almoco ' || '' || NVL(:OLD.IDTPSEALMOCO,'' );
            END IF;
            IF :OLD.IDTPSELTARDE IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Lanche Tarde ' || '' || NVL(:OLD.IDTPSELTARDE,'' );
            END IF;
            IF :OLD.IDATUCPFCONS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Atualiza CPF na Venda ' || '' || NVL(:OLD.IDATUCPFCONS,'' );
            END IF;
            IF :OLD.CDCONSVINCULO IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Cons Vinculo ' || '' || NVL(:OLD.CDCONSVINCULO,'' );
            END IF;
            IF :OLD.NMQUADRANTE IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Quadrante ' || '' || NVL(:OLD.NMQUADRANTE,'' );
            END IF;
            IF :OLD.VRSUBSBASICO IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Valor Sub Basico ' || '' || NVL(:OLD.VRSUBSBASICO,'' );
            END IF;
            IF :OLD.VRMAXCONSMENSAL IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Valor Max Cons Mensal ' || '' || NVL(:OLD.VRMAXCONSMENSAL,'' );
            END IF;
            IF :OLD.IDBLOQSALDFS IS NOT NULL THEN
               V_DESC := NVL(V_DESC, '') || '' || ' Bloq Ut Saldo Fim Sem ' || '' || NVL(:OLD.IDBLOQSALDFS,'' );
            END IF;

            V_ITPESQ := :OLD.CDCLIENTE||:OLD.CDCONSUMIDOR;
            V_IDTIPOOPER := '3';
         END IF;
      END IF;
   END IF;
   V_DESC := SUBSTR(V_DESC, 1, 300);
   V_ITPESQ := SUBSTR(V_ITPESQ, 1, 40);
   INSERT INTO LOGOPERAVND
      (NMTABELAVND,
       DTOPERACAOVND,
       NMRESPOPERVND,
       IDTIPOOPERVND,
       DSOPERACAOVND,
       CDPESQITEMVND,
       DSRDMUSUOPERVND,
       DSENDUSUOPERVND,
       DSNMUSUOPERVND,
       DSMETUSUOPERVND,
       CDORESPOPERVND)
   VALUES
      ('CONSUMIDOR',
       SYSDATE, 
       NVL(V_NMOPERADOR,' '),
       V_IDTIPOOPER,
       NVL(V_DESC,' '),
       V_ITPESQ,
       V_DSSERVERRDM,
       V_DSREMOTEADDR,
       V_DSREMOTEHOST,
       V_DSSERVMETHOD,
       V_DSREMOTEOPER);
END;
/

-- VERSAO --
BEGIN ATUVEROBJ('LOG_VND_CONSUMIDOR','5.20.001'); END;
/
