CREATE OR REPLACE TRIGGER LOG_GER_CLIENTE
AFTER UPDATE OR INSERT OR DELETE
ON CLIENTE 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(1300);
  V_ITPESQ       VARCHAR2(40);
  V_NMOPERADOR   VARCHAR2(40);
  V_IDCLIEATIV   VARCHAR2(20);
  V_NRINCREST    VARCHAR2(40);
  V_IDTIPOOPER   VARCHAR2(1);

BEGIN
/* IDTIPOOPER - '1' - Inclusao, '2' - Alteracao, '3' - Exclusao*/

   V_DESC       := '';
   V_ITPESQ     := '';
   V_NMOPERADOR := '';
   V_IDCLIEATIV := '';
   V_NRINCREST  := '';
   V_IDTIPOOPER := '';

   NMUSUARIO(V_NMOPERADOR);
   WEBTUNNING(V_DSREMOTEADDR,
              V_DSREMOTEHOST,
              V_DSSERVERRDM,
              V_DSSERVMETHOD,
              V_DSREMOTEOPER);

   IF INSERTING THEN
      IF NOT ((:NEW.IDCLIEATIV) IS NULL) THEN
         IF :NEW.IDCLIEATIV = 'S' THEN
            V_IDCLIEATIV :=  'Cliente: Ativo';
         ELSE
            V_IDCLIEATIV :=  'Cliente: Inativo';
         END IF;
      END IF;

      IF NOT ((:NEW.NRINSESTCLIE) IS NULL) THEN
         V_NRINCREST := 'Nr.Inscr.Estadual:' || ' ' || :NEW.NRINSESTCLIE;
      END IF;

      V_DESC  := 'NrInscricao='       ||' '||:NEW.NRINSJURCLIE   ||' '||
                 'TipoInscricao='     ||' '||:NEW.IDTPIJURCLIE   ||' '||
                 'RazaoSocial='       ||' '||:NEW.NMRAZSOCCLIE   ||' '||
                 'NmFantasia='        ||' '||:NEW.NMFANTCLIE     ||' '||
                  V_NRINCREST         ||' '||V_IDCLIEATIV        ||' '||
                 'GrupoFiscal='       ||' '||:NEW.CDGRUPOFISC    ||' '||
                 'InscrSuframa='      ||' '||:NEW.NRINSCSUFRAMACL||' '||
                 'CompactaXML='       ||' '||:NEW.IDCOMPARQXMLCLI||' '||
                 'TpEnderGeracaoCFOP='||' '||:NEW.IDENDCFOPCLI   ||' '||
                 'GravaObsClie='      ||' '||:NEW.IDGRAVOBSCLIPED||' ';

      V_ITPESQ := :NEW.CDCLIENTE;
      V_IDTIPOOPER := '1';
   ELSE
      IF UPDATING THEN
         IF (NVL(:OLD.NRINSJURCLIE,'!') <> NVL(:NEW.NRINSJURCLIE,'!')) THEN
            V_DESC := V_DESC || 'NrInscricao=' || :NEW.NRINSJURCLIE;
         END IF;

         IF (NVL(:OLD.IDTPIJURCLIE,'!') <> NVL(:NEW.IDTPIJURCLIE,'!')) THEN
            V_DESC := V_DESC || 'TipoInscricao=' || :NEW.IDTPIJURCLIE;
         END IF;

         IF (NVL(:OLD.NMRAZSOCCLIE,'!') <> NVL(:NEW.NMRAZSOCCLIE,'!')) THEN
            V_DESC := V_DESC || 'RazaoSocial=' || :NEW.NMRAZSOCCLIE;
         END IF;

         IF (NVL(:OLD.NMFANTCLIE,'!') <> NVL(:NEW.NMFANTCLIE,'!')) THEN
            V_DESC := V_DESC || 'NmFantasia=' || :NEW.NMFANTCLIE;
         END IF;

         IF (NVL(:OLD.NRINSESTCLIE,'!') <> NVL(:NEW.NRINSESTCLIE,'!')) THEN
            V_DESC := V_DESC || 'InscEstadual=' || :NEW.NRINSESTCLIE;
         END IF;

         IF (NVL(:OLD.IDENDEMISCLI,'!') <> NVL(:NEW.IDENDEMISCLI,'!')) THEN
            V_DESC := V_DESC || 'TpEnderEmisDoc=' || :NEW.IDENDEMISCLI;
         END IF;

         IF (NVL(:OLD.IDENDCFOPCLI,'!') <> NVL(:NEW.IDENDCFOPCLI,'!')) THEN
            V_DESC := V_DESC || 'TpEnderGeracaoCFOP=' || :NEW.IDENDCFOPCLI;
         END IF;

         IF (NVL(:OLD.NMAVALCLIE,'!') <> NVL(:NEW.NMAVALCLIE,'!')) THEN
            V_DESC := V_DESC || 'NmAvalCliente=' || :NEW.NMAVALCLIE;
         END IF;

         IF (NVL(:OLD.VRPEMARGLUCR,0) <> NVL(:NEW.VRPEMARGLUCR,0)) THEN
            V_DESC := V_DESC || 'PercentMargemLucro=' || :NEW.VRPEMARGLUCR;
         END IF;

         IF (NVL(:OLD.QTCNDPG1CLIE,0) <> NVL(:NEW.QTCNDPG1CLIE,0)) THEN
            V_DESC := V_DESC || 'QtdDiasPrazo1Parcela=' || :NEW.QTCNDPG1CLIE;
         END IF;

         IF (NVL(:OLD.QTCNDPG2CLIE,0) <> NVL(:NEW.QTCNDPG2CLIE,0)) THEN
            V_DESC := V_DESC || 'QtdDiasPrazo2Parcela=' || :NEW.QTCNDPG2CLIE;
         END IF;

         IF (NVL(:OLD.QTCNDPG3CLIE,0) <> NVL(:NEW.QTCNDPG3CLIE,0)) THEN
            V_DESC := V_DESC || 'QtdDiasPrazo3Parcela=' || :NEW.QTCNDPG3CLIE;
         END IF;

         IF (NVL(:OLD.QTCNDPG4CLIE,0) <> NVL(:NEW.QTCNDPG4CLIE,0)) THEN
            V_DESC := V_DESC || 'QtdDiasPrazo4Parcela=' || :NEW.QTCNDPG4CLIE;
         END IF;

         IF (NVL(:OLD.QTCNDPG5CLIE,0) <> NVL(:NEW.QTCNDPG5CLIE,0)) THEN
            V_DESC := V_DESC || 'QtdDiasPrazo5Parcela=' || :NEW.QTCNDPG5CLIE;
         END IF;

         IF (NVL(:OLD.QTCNDPG6CLIE,0) <> NVL(:NEW.QTCNDPG6CLIE,0)) THEN
            V_DESC := V_DESC || 'QtdDiasPrazo6Parcela=' || :NEW.QTCNDPG6CLIE;
         END IF;

         IF (NVL(:OLD.IDFORMPGCLIE,'!') <> NVL(:NEW.IDFORMPGCLIE,'!')) THEN
            V_DESC := V_DESC || 'FormaPgtoClie=' || :NEW.IDFORMPGCLIE;
         END IF;

         IF (NVL(:OLD.VRPERPG1CLIE,0) <> NVL(:NEW.VRPERPG1CLIE,0)) THEN
            V_DESC := V_DESC || 'PercentCorresp1Parcela=' || :NEW.VRPERPG1CLIE;
         END IF;

         IF (NVL(:OLD.VRPERPG2CLIE,0) <> NVL(:NEW.VRPERPG2CLIE,0)) THEN
            V_DESC := V_DESC || 'PercentCorresp2Parcela=' || :NEW.VRPERPG2CLIE;
         END IF;

         IF (NVL(:OLD.VRPERPG3CLIE,0) <> NVL(:NEW.VRPERPG3CLIE,0)) THEN
            V_DESC := V_DESC || 'PercentCorresp3Parcela=' || :NEW.VRPERPG3CLIE ;
         END IF;

         IF (NVL(:OLD.VRPERPG4CLIE,0) <> NVL(:NEW.VRPERPG4CLIE,0)) THEN
            V_DESC := V_DESC || 'PercentCorresp4Parcela=' || :NEW.VRPERPG4CLIE;
         END IF;

         IF (NVL(:OLD.VRPERPG5CLIE,0) <> NVL(:NEW.VRPERPG5CLIE,0)) THEN
            V_DESC := V_DESC || 'PercentCorresp5Parcela=' || :NEW.VRPERPG5CLIE;
         END IF;

         IF (NVL(:OLD.VRPERPG6CLIE,0) <> NVL(:NEW.VRPERPG6CLIE,0)) THEN
            V_DESC := V_DESC || 'PercentCorresp6Parcela=' || :NEW.VRPERPG6CLIE;
         END IF;

         IF (NVL(:OLD.CDFORMPGTO,'!') <> NVL(:NEW.CDFORMPGTO,'!')) THEN
            V_DESC := V_DESC || 'FormaPgto=' || :NEW.CDFORMPGTO;
         END IF;

         IF (NVL(:OLD.IDTPFORPGTCL,'!') <> NVL(:NEW.IDTPFORPGTCL,'!')) THEN
            V_DESC := V_DESC || 'TpFormaPgtoClie=' || :NEW.IDTPFORPGTCL;
         END IF;

         IF (NVL(:OLD.NRPARCPGTOCL,0) <> NVL(:NEW.NRPARCPGTOCL,0)) THEN
            V_DESC := V_DESC || 'NrParcPgtoClie=' || :NEW.NRPARCPGTOCL;
         END IF;

         IF (NVL(:OLD.NRDIAPGFIXCL,0) <> NVL(:NEW.NRDIAPGFIXCL,0)) THEN
            V_DESC := V_DESC || 'DiaConsidBCDataPgtoCli=' || :NEW.NRDIAPGFIXCL;
         END IF;

         IF (NVL(:OLD.IDUTDIAPGTCL,'!') <> NVL(:NEW.IDUTDIAPGTCL,'!')) THEN
            V_DESC := V_DESC || 'UtilDiaPgto=' || :NEW.IDUTDIAPGTCL;
         END IF;

         IF (NVL(:OLD.VRPEMORBCLI,0) <> NVL(:NEW.VRPEMORBCLI,0)) THEN
            V_DESC := V_DESC || 'PercentMoraDiariaBolReceber=' || :NEW.VRPEMORBCLI;
         END IF;

         IF (NVL(:OLD.VRPEMULBCLI,0) <> NVL(:NEW.VRPEMULBCLI,0)) THEN
            V_DESC := V_DESC || 'PercentMultaBolReceber=' || :NEW.VRPEMULBCLI;
         END IF;

         IF (NVL(:OLD.CDSEGMER,'!') <> NVL(:NEW.CDSEGMER,'!')) THEN
            V_DESC := V_DESC || 'SegMercado=' || :NEW.CDSEGMER;
         END IF;

         IF (NVL(:OLD.CDATIVCLI,'!') <> NVL(:NEW.CDATIVCLI,'!')) THEN
            V_DESC := V_DESC || 'CodAtivCliente=' || :NEW.CDATIVCLI;
         END IF;

         IF (NVL(:OLD.VRCAPITALCLI,0) <> NVL(:NEW.VRCAPITALCLI,0)) THEN
            V_DESC := V_DESC || 'VrCapital=' || :NEW.VRCAPITALCLI;
         END IF;

         IF (NVL(:OLD.VRPATLIQCLI,0) <> NVL(:NEW.VRPATLIQCLI,0)) THEN
            V_DESC := V_DESC || 'VrPatrimonioLiqClie=' || :NEW.VRPATLIQCLI;
         END IF;

         IF (NVL(TO_CHAR(:OLD.DTVALVALCLI,'DD/MM/YYYY'), 'W')  <> NVL(TO_CHAR(:NEW.DTVALVALCLI,'DD/MM/YYYY'),'W')) THEN
            V_DESC := V_DESC || 'DtValidVrCapitalLiquido=' ||' '|| NVL(TO_CHAR(:NEW.DTVALVALCLI, 'DD/MM/YYYY'),'');
         END IF;

         IF (NVL(:OLD.VRLIMCREDCLI,0) <> NVL(:NEW.VRLIMCREDCLI,0)) THEN
            V_DESC := V_DESC || 'VrLimCredito=' || :NEW.VRLIMCREDCLI;
         END IF;

         IF (NVL(TO_CHAR(:OLD.DTVALLIMCLI,'DD/MM/YYYY'),'W')   <> NVL( TO_CHAR(:NEW.DTVALLIMCLI,'DD/MM/YYYY'),'W') ) THEN
            V_DESC := V_DESC || 'DtValLimite=' || NVL(TO_CHAR(:NEW.DTVALLIMCLI, 'DD/MM/YYYY') ,'');
         END IF;

         IF (NVL(:OLD.CDTPCTRECEB,'!') <> NVL(:NEW.CDTPCTRECEB,'!')) THEN
            V_DESC := V_DESC || 'TpContaReceber=' || :NEW.CDTPCTRECEB;
         END IF;

         IF (NVL(:OLD.CDCSTDIG1CLI,'!') <> NVL(:NEW.CDCSTDIG1CLI,'!')) THEN
            V_DESC := V_DESC || '1DigCST=' || :NEW.CDCSTDIG1CLI;
         END IF;

         IF (NVL(:OLD.IDUTLICEUSO,'!') <> NVL(:NEW.IDUTLICEUSO,'!')) THEN
            V_DESC := V_DESC || 'TpUtilLicencaDeUsoEmisNF=' || :NEW.IDUTLICEUSO;
         END IF;

         IF (NVL(:OLD.CDVENDEDOR,'!') <> NVL(:NEW.CDVENDEDOR,'!')) THEN
            V_DESC := V_DESC || 'CodVendedor=' || :NEW.CDVENDEDOR;
         END IF;

         IF (NVL(:OLD.IDTIPINFCOME,'!') <> NVL(:NEW.IDTIPINFCOME,'!')) THEN
            V_DESC := V_DESC || 'TpInformComensalExib=' || :NEW.IDTIPINFCOME;
         END IF;

         IF (NVL(TO_CHAR(:OLD.DTICOINFCOME,'DD/MM/YYYY'),'W') <>  NVL( TO_CHAR(:NEW.DTICOINFCOME,'DD/MM/YYYY'),'W')) THEN
            V_DESC := V_DESC || 'DtIniPerConsultVendaAcumulComensal=' || NVL(TO_CHAR(:NEW.DTICOINFCOME, 'DD/MM/YYYY'),'');
         END IF;

         IF (NVL(TO_CHAR(:OLD.DTFCOINFCOME,'DD/MM/YYYY'),'W') <> NVL( TO_CHAR(:NEW.DTFCOINFCOME,'DD/MM/YYYY'),'W')) THEN
            V_DESC := V_DESC || 'DtFinPerConsultVendaAcumulComensal=' || NVL(TO_CHAR(:NEW.DTFCOINFCOME, 'DD/MM/YYYY'),'');
         END IF;

         IF (NVL(:OLD.DSHOMEPACLI,'!') <> NVL(:NEW.DSHOMEPACLI,'!')) THEN
            V_DESC := V_DESC || 'HomePage=' || :NEW.DSHOMEPACLI;
         END IF;

         IF (NVL(TO_CHAR(:OLD.DTCADACLIE,'DD/MM/YYYY'), 'W')  <> NVL( TO_CHAR(:NEW.DTCADACLIE,'DD/MM/YYYY'), 'W')) THEN
            V_DESC := V_DESC || 'DtInclusaoClie=' || NVL(TO_CHAR(:NEW.DTCADACLIE,'DD/MM/YYYY'),'');
         END IF;

         IF (NVL(:OLD.IDCONTRIBCLI,'!') <> NVL(:NEW.IDCONTRIBCLI,'!')) THEN
            V_DESC := V_DESC || 'TpContribuicao=' || :NEW.IDCONTRIBCLI;
         END IF;

         IF (NVL(:OLD.IDCLIECONTRI,'!') <> NVL(:NEW.IDCLIECONTRI,'!')) THEN
            V_DESC := V_DESC || 'ClieContribImpostos=' || :NEW.IDCLIECONTRI;
         END IF;

         IF (NVL(:OLD.CDCFOPCLIE,'!') <> NVL(:NEW.CDCFOPCLIE,'!')) THEN
            V_DESC := V_DESC ||'CodCFOpClieNContrib=' || :NEW.CDCFOPCLIE;
         END IF;

         IF (NVL(:OLD.DSCFOPCLIE,'!') <> NVL(:NEW.DSCFOPCLIE,'!')) THEN
            V_DESC := V_DESC || 'DescCFOpClieNContrib=' || :NEW.DSCFOPCLIE;
         END IF;

         IF (NVL(:OLD.IDCLIEATIV,'!') <> NVL(:NEW.IDCLIEATIV,'!')) THEN
            V_DESC := V_DESC || 'SitClieAtivoInat=' || :NEW.IDCLIEATIV;
         END IF;

         IF (NVL(:OLD.CDMODODIVULG,'!') <> NVL(:NEW.CDMODODIVULG,'!')) THEN
            V_DESC := V_DESC || 'CodModoDivulg=' || :NEW.CDMODODIVULG;
         END IF;

         IF (NVL(:OLD.CDESTACIVIL,'!') <> NVL(:NEW.CDESTACIVIL,'!')) THEN
            V_DESC := V_DESC || 'EstadoCivil=' || :NEW.CDESTACIVIL;
         END IF;

         IF (NVL(:OLD.CDPROSPECT,'!') <> NVL(:NEW.CDPROSPECT,'!')) THEN
            V_DESC := V_DESC || 'CodProspect=' || :NEW.CDPROSPECT;
         END IF;

         IF (NVL(:OLD.CDESCOLARIDADE,'!')  <> NVL(:NEW.CDESCOLARIDADE,'!')) THEN
            V_DESC := V_DESC || 'Escolaridade=' || :NEW.CDESCOLARIDADE;
         END IF;

         IF (NVL(:OLD.CDESCOLA,'!') <> NVL(:NEW.CDESCOLA,'!')) THEN
            V_DESC := V_DESC || 'CodEscola=' || :NEW.CDESCOLA;
         END IF;

         IF (NVL(:OLD.CDFIAVALESTA,'!') <> NVL(:NEW.CDFIAVALESTA,'!')) THEN
            V_DESC := V_DESC || 'CodFilialAvali=' || :NEW.CDFIAVALESTA;
         END IF;

         IF (NVL(:OLD.CDAVALESTA,'!') <> NVL(:NEW.CDAVALESTA,'!')) THEN
            V_DESC := V_DESC || 'CodAvaliacao=' || :NEW.CDAVALESTA;
         END IF;

         IF (NVL(:OLD.NMMAECLIE,'!') <> NVL(:NEW.NMMAECLIE,'!')) THEN
            V_DESC := V_DESC || 'NomeMae=' || :NEW.NMMAECLIE;
         END IF;

         IF (NVL(:OLD.NMPAICLIE,'!') <> NVL(:NEW.NMPAICLIE,'!')) THEN
            V_DESC := V_DESC || 'NomePai=' || :NEW.NMPAICLIE;
         END IF;

         IF (NVL(TO_CHAR(:OLD.DTNASCCLIE,'DD/MM/YYYY'),'W')    <>    NVL(TO_CHAR(:NEW.DTNASCCLIE,'DD/MM/YYYY'),'W')) THEN
            V_DESC := V_DESC || 'DtNascimento=' || NVL(TO_CHAR(:NEW.DTNASCCLIE, 'DD/MM/YYYY'),'');
         END IF;

         IF (NVL(:OLD.DSNATURCLIE,'!') <> NVL(:NEW.DSNATURCLIE,'!')) THEN
            V_DESC := V_DESC || 'Naturalidade=' || :NEW.DSNATURCLIE;
         END IF;

         IF (NVL(:OLD.IDSEXOCLIE,'!') <> NVL(:NEW.IDSEXOCLIE,'!')) THEN
            V_DESC := V_DESC || 'Sexo=' || :NEW.IDSEXOCLIE;
         END IF;

         IF (NVL(:OLD.IDTRABCLIE,'!') <> NVL(:NEW.IDTRABCLIE,'!')) THEN
            V_DESC := V_DESC || 'ClieTrabalha=' || :NEW.IDTRABCLIE;
         END IF;

         IF (NVL(:OLD.DSLOCTRCLIE,'!') <> NVL(:NEW.DSLOCTRCLIE,'!')) THEN
            V_DESC := V_DESC || 'LocTrabaCliente=' || :NEW.DSLOCTRCLIE;
         END IF;

         IF (NVL(:OLD.IDESTUDACLIE,'!') <> NVL(:NEW.IDESTUDACLIE,'!')) THEN
            V_DESC := V_DESC || 'ClieEstuda=' || :NEW.IDESTUDACLIE;
         END IF;

         IF (NVL(:OLD.IDTESTNIVCLI,'!') <> NVL(:NEW.IDTESTNIVCLI,'!')) THEN
            V_DESC := V_DESC || 'IdRealizTesteNivelClie=' || :NEW.IDTESTNIVCLI;
         END IF;

         IF (NVL(:OLD.VRTESTNIVCLI,0) <> NVL(:NEW.VRTESTNIVCLI,0)) THEN
            V_DESC := V_DESC || 'VrNFTesteNivelClie=' || :NEW.VRTESTNIVCLI;
         END IF;

         IF (NVL(:OLD.IDTIPOCLIE,'!') <> NVL(:NEW.IDTIPOCLIE,'!')) THEN
            V_DESC := V_DESC || 'IdTpClie=' || :NEW.IDTIPOCLIE;
         END IF;

         IF (NVL(:OLD.CDPROFISSAO,'!') <> NVL(:NEW.CDPROFISSAO,'!')) THEN
            V_DESC := V_DESC || 'CodProfissao=' || :NEW.CDPROFISSAO;
         END IF;

         IF (NVL(:OLD.CDGRUPOFISC,'!') <> NVL(:NEW.CDGRUPOFISC,'!')) THEN
            V_DESC := V_DESC || 'GrupoFiscal=' || :NEW.CDGRUPOFISC;
         END IF;

         IF (NVL(:OLD.NMRESPCLIE,'!') <> NVL(:NEW.NMRESPCLIE,'!')) THEN
            V_DESC := V_DESC || 'NmRespClie=' || :NEW.NMRESPCLIE;
         END IF;

         IF (NVL(TO_CHAR(:OLD.DTTESTNIVCLI,'DD/MM/YYYY'),'W')  <>  NVL( TO_CHAR(:NEW.DTTESTNIVCLI,'DD/MM/YYYY'),'W')) THEN
            V_DESC := V_DESC || 'DtAplicTesteNivelClie=' || NVL(TO_CHAR(:NEW.DTTESTNIVCLI, 'DD/MM/YYYY'),'');
         END IF;

         IF (NVL(:OLD.NRCPFCLIE,'!') <> NVL(:NEW.NRCPFCLIE,'!')) THEN
            V_DESC := V_DESC || 'NrCPF=' || :NEW.NRCPFCLIE;
         END IF;

         IF (NVL(:OLD.NRRGCLIE,'!') <> NVL(:NEW.NRRGCLIE,'!')) THEN
            V_DESC := V_DESC || 'NrCartIdentidade=' || :NEW.NRRGCLIE;
         END IF;

         IF (NVL(:OLD.CDEXRGCLIE,'!') <> NVL(:NEW.CDEXRGCLIE,'!')) THEN
            V_DESC := V_DESC || 'OrgaoExpedRG=' || :NEW.CDEXRGCLIE;
         END IF;

         IF (NVL(TO_CHAR(:OLD.DTEXRGCLIE, 'DD/MM/YYYY'),'W') <> NVL( TO_CHAR(:NEW.DTEXRGCLIE,'DD/MM/YYYY') ,'W')) THEN
            V_DESC := V_DESC || 'DtExpedRg=' || NVL(TO_CHAR(:NEW.DTEXRGCLIE, 'DD/MM/YYYY'),'');
         END IF;

         IF (NVL(:OLD.CDEMPFCAPCLI,'!') <> NVL(:NEW.CDEMPFCAPCLI,'!')) THEN
            V_DESC := V_DESC || '?=' || :NEW.CDEMPFCAPCLI;
         END IF;

         IF (NVL(:OLD.CDFUNCCAPCLI,'!') <> NVL(:NEW.CDFUNCCAPCLI,'!')) THEN
            V_DESC := V_DESC || '?=' || :NEW.CDFUNCCAPCLI;
         END IF;

         IF (NVL(:OLD.CDEMPFAPLTES,'!') <> NVL(:NEW.CDEMPFAPLTES,'!')) THEN
            V_DESC := V_DESC || '?=' || :NEW.CDEMPFAPLTES;
         END IF;

         IF (NVL(:OLD.CDFUNCAPLTES,'!') <> NVL(:NEW.CDFUNCAPLTES,'!')) THEN
            V_DESC := V_DESC || '?=' || :NEW.CDFUNCAPLTES;
         END IF;

         IF (NVL(:OLD.NRTURNO,'!') <> NVL(:NEW.NRTURNO,'!')) THEN
            V_DESC := V_DESC || 'NumTurno=' || :NEW.NRTURNO;
         END IF;

         IF (NVL(:OLD.IDSEGCLIP,'!') <> NVL(:NEW.IDSEGCLIP,'!')) THEN
            V_DESC := V_DESC || 'IdPrefProspectAulaSeg=' || :NEW.IDSEGCLIP;
         END IF;

         IF (NVL(:OLD.IDTERCLIP,'!') <> NVL(:NEW.IDTERCLIP,'!')) THEN
            V_DESC := V_DESC || 'IdPrefProspectAulaTer=' || :NEW.IDTERCLIP;
         END IF;

         IF (NVL(:OLD.IDQUACLIP,'!') <> NVL(:NEW.IDQUACLIP,'!')) THEN
            V_DESC := V_DESC || 'IdPrefProspectAulaQua=' || :NEW.IDQUACLIP;
         END IF;

         IF (NVL(:OLD.IDQUICLIP,'!') <> NVL(:NEW.IDQUICLIP,'!')) THEN
            V_DESC := V_DESC || 'IdPrefProspectAulaQui=' || :NEW.IDQUICLIP;
         END IF;

         IF (NVL(:OLD.IDSEXCLIP,'!') <> NVL(:NEW.IDSEXCLIP,'!')) THEN
            V_DESC := V_DESC || 'IdPrefProspectAulaSex=' || :NEW.IDSEXCLIP;
         END IF;

         IF (NVL(:OLD.IDSABCLIP,'!') <> NVL(:NEW.IDSABCLIP,'!')) THEN
            V_DESC := V_DESC || 'IdPrefProspectAulaSab=' || :NEW.IDSABCLIP;
         END IF;

         IF (NVL(:OLD.IDDOMCLIP,'!') <> NVL(:NEW.IDDOMCLIP,'!')) THEN
            V_DESC := V_DESC || 'IdPrefProspectAulaDom=' || :NEW.IDDOMCLIP;
         END IF;

         IF (NVL(:OLD.IDRECINFMKT,'!') <> NVL(:NEW.IDRECINFMKT,'!')) THEN
            V_DESC := V_DESC || 'IdOpcaoRecInfMarketing=' || :NEW.IDRECINFMKT;
         END IF;

         IF (NVL(:OLD.CDFILORIGCLI,'!') <> NVL(:NEW.CDFILORIGCLI,'!')) THEN
            V_DESC := V_DESC || 'CodFilOrig=' || :NEW.CDFILORIGCLI;
         END IF;

         IF (NVL(:OLD.CDFILESTAPTO,'!') <> NVL(:NEW.CDFILESTAPTO,'!')) THEN
            V_DESC := V_DESC || '?=' || :NEW.CDFILESTAPTO;
         END IF;

         IF (NVL(:OLD.CDESTAGIAPTO,'!') <> NVL(:NEW.CDESTAGIAPTO,'!')) THEN
            V_DESC := V_DESC || '?=' || :NEW.CDESTAGIAPTO;
         END IF;

         IF (NVL(:OLD.CDEXCLIENTE,'!') <> NVL(:NEW.CDEXCLIENTE,'!')) THEN
            V_DESC := V_DESC || 'CodExternoClie=' || :NEW.CDEXCLIENTE;
         END IF;

         IF (NVL(:OLD.IDPRIPUBCLIE,'!') <> NVL(:NEW.IDPRIPUBCLIE,'!')) THEN
            V_DESC := V_DESC || 'IdCliePubl/Priv=' || :NEW.IDPRIPUBCLIE;
         END IF;

         IF (NVL(:OLD.VRPEFORPRECO,0) <> NVL(:NEW.VRPEFORPRECO,0)) THEN
            V_DESC := V_DESC || 'VrPercentUtilFormPrecoVenda=' || :NEW.VRPEFORPRECO;
         END IF;

         IF (NVL(:OLD.IDVERSALDCLI,'!') <> NVL(:NEW.IDVERSALDCLI,'!')) THEN
            V_DESC := V_DESC || 'IdVerifSaldoClie=' || :NEW.IDVERSALDCLI;
         END IF;

         IF (NVL(:OLD.IDUTSALDCLI,'!') <> NVL(:NEW.IDUTSALDCLI,'!')) THEN
            V_DESC := V_DESC || 'IdUtilSaldoClie=' || :NEW.IDUTSALDCLI;
         END IF;

         IF (NVL(:OLD.IDCALCDVCLIE,'!') <> NVL(:NEW.IDCALCDVCLIE,'!')) THEN
            V_DESC := V_DESC || 'IdCalcDigVerifCracha=' || :NEW.IDCALCDVCLIE;
         END IF;

         IF (NVL(:OLD.IDUTSUBCLIEN,'!') <> NVL(:NEW.IDUTSUBCLIEN,'!')) THEN
            V_DESC := V_DESC || 'IdUtilSubsidio=' || :NEW.IDUTSUBCLIEN;
         END IF;

         IF (NVL(:OLD.VRPESUBCLIEN,0) <> NVL(:NEW.VRPESUBCLIEN,0)) THEN
            V_DESC := V_DESC || 'PercentSubsidioClie=' || :NEW.VRPESUBCLIEN;
         END IF;

         IF (NVL(:OLD.IDLIBGERPER,'!') <> NVL(:NEW.IDLIBGERPER,'!')) THEN
            V_DESC := V_DESC || 'IdLiberGeracaoPER=' || :NEW.IDLIBGERPER;
         END IF;

         IF (NVL(:OLD.NRDIAVALPERS,0) <> NVL(:NEW.NRDIAVALPERS,0)) THEN
            V_DESC := V_DESC || 'NumDiasValidGeracaoPer=' || :NEW.NRDIAVALPERS;
         END IF;

         IF (NVL(:OLD.CDCARGOCNJCL,'!') <> NVL(:NEW.CDCARGOCNJCL,'!')) THEN
            V_DESC := V_DESC || '?=' || :NEW.CDCARGOCNJCL;
         END IF;

         IF (NVL(:OLD.CDCARGOCLIE,'!') <> NVL(:NEW.CDCARGOCLIE,'!')) THEN
            V_DESC := V_DESC || '?=' || :NEW.CDCARGOCLIE;
         END IF;

         IF (NVL(:OLD.NRCARPROCLIE,'!') <> NVL(:NEW.NRCARPROCLIE,'!')) THEN
            V_DESC := V_DESC || '?=' || :NEW.NRCARPROCLIE;
         END IF;

         IF (NVL(:OLD.VRSALARICLIE,0) <> NVL(:NEW.VRSALARICLIE,0)) THEN
            V_DESC := V_DESC || 'VrSalarioClie=' || :NEW.VRSALARICLIE;
         END IF;

         IF (NVL(:OLD.NMCONJUGCLIE,'!') <> NVL(:NEW.NMCONJUGCLIE,'!')) THEN
            V_DESC := V_DESC || 'NmConjugeClie=' || :NEW.NMCONJUGCLIE;
         END IF;

         IF (NVL(TO_CHAR(:OLD.DTNASCNJCLIE, 'DD/MM/YYYY'),'W')   <>   NVL(TO_CHAR(:NEW.DTNASCNJCLIE,'DD/MM/YYYY'), 'W')) THEN
            V_DESC := V_DESC || 'DtNascConjugeClie=' || NVL(TO_CHAR(:NEW.DTNASCNJCLIE, 'DD/MM/YYYY'),'');
         END IF;

         IF (NVL(:OLD.NMEMPCNJCLIE,'!') <> NVL(:NEW.NMEMPCNJCLIE,'!')) THEN
            V_DESC := V_DESC || 'NmEmpConjugeClie=' || :NEW.NMEMPCNJCLIE;
         END IF;

         IF (NVL(:OLD.VRSALCNJCLIE,0) <> NVL(:NEW.VRSALCNJCLIE,0)) THEN
            V_DESC := V_DESC || 'VrSalarioClie=' || :NEW.VRSALCNJCLIE;
         END IF;

         IF (NVL(:OLD.NRCPFCNJCLIE,'!') <> NVL(:NEW.NRCPFCNJCLIE,'!')) THEN
            V_DESC := V_DESC || 'NrCPFConjugue=' || :NEW.NRCPFCNJCLIE;
         END IF;

         IF (NVL(:OLD.NRRGCNJCLIE,'!') <> NVL(:NEW.NRRGCNJCLIE,'!')) THEN
            V_DESC := V_DESC || 'NrRgConjugue=' || :NEW.NRRGCNJCLIE;
         END IF;

         IF (NVL(:OLD.CDEXRGCNJCLI,'!') <> NVL(:NEW.CDEXRGCNJCLI,'!')) THEN
            V_DESC := V_DESC || 'OrgaoemisRGConjugue=' || :NEW.CDEXRGCNJCLI;
         END IF;

         IF (NVL(TO_CHAR(:OLD.DTEXRGCNJCLI,'DD/MM/YYYY'),'W') <> NVL( TO_CHAR(:NEW.DTEXRGCNJCLI, 'DD/MM/YYYY'),'W')) THEN
            V_DESC := V_DESC || 'DtExpedRGConjugue=' || NVL(TO_CHAR(:NEW.DTEXRGCNJCLI, 'DD/MM/YYYY'),'');
         END IF;

         IF (NVL(TO_CHAR(:OLD.DTVALARQPERS, 'DD/MM/YYYY'),'W') <> NVL(TO_CHAR(:NEW.DTVALARQPERS,'DD/MM/YYYY'),'W')) THEN
            V_DESC := V_DESC || 'DtValidArqPER=' || NVL(TO_CHAR(:NEW.DTVALARQPERS, 'DD/MM/YYYY'),'');
         END IF;

         IF (NVL(:OLD.DSEMAILENVCL,'!') <> NVL(:NEW.DSEMAILENVCL,'!')) THEN
            V_DESC := V_DESC || 'EndEmailEnvioPER=' || :NEW.DSEMAILENVCL;
         END IF;

         IF (NVL(:OLD.DSEMAILCOMCL,'!') <> NVL(:NEW.DSEMAILCOMCL,'!')) THEN
            V_DESC := V_DESC || 'EndEmailComunicEnvioPER=' || :NEW.DSEMAILCOMCL;
         END IF;

         IF (NVL(:OLD.IDRESPROPCLI,'!') <> NVL(:NEW.IDRESPROPCLI,'!')) THEN
            V_DESC := V_DESC || 'IdResidenciaPropria=' || :NEW.IDRESPROPCLI;
         END IF;

         IF (NVL(:OLD.NRMESRESCLIE,0) <> NVL(:NEW.NRMESRESCLIE,0)) THEN
            V_DESC := V_DESC || 'NumMesesResidClie=' || :NEW.NRMESRESCLIE;
         END IF;

         IF (NVL(:OLD.NRANORESCLIE,0) <> NVL(:NEW.NRANORESCLIE,0)) THEN
            V_DESC := V_DESC || 'NumAnosResidClie=' || :NEW.NRANORESCLIE;
         END IF;

         IF (NVL(:OLD.IDZERSALDCON,'!') <> NVL(:NEW.IDZERSALDCON,'!')) THEN
            V_DESC := V_DESC || 'IdSaldoConsumidorZerado=' || :NEW.IDZERSALDCON;
         END IF;

         IF (NVL(:OLD.IDGERNFCLIE,'!') <> NVL(:NEW.IDGERNFCLIE,'!')) THEN
            V_DESC := V_DESC || 'IdQuebraGeracaoNFExped=' || :NEW.IDGERNFCLIE;
         END IF;

         IF (NVL(:OLD.CDIDCLIENTE,'!') <> NVL(:NEW.CDIDCLIENTE,'!')) THEN
            V_DESC := V_DESC || 'CodIdentifClieUtilURA=' || :NEW.CDIDCLIENTE;
         END IF;

         IF (NVL(:OLD.IDSITFINCLIE,'!') <> NVL(:NEW.IDSITFINCLIE,'!')) THEN
            V_DESC := V_DESC || 'IdSituFinanceiraClie=' || :NEW.IDSITFINCLIE;
         END IF;

         IF (NVL(TO_CHAR(:OLD.DTINITRCLIE,'DD/MM/YYYY'),'W')<> NVL( TO_CHAR(:NEW.DTINITRCLIE, 'DD/MM/YYYY'),'W')) THEN
            V_DESC := V_DESC || 'DtIniTrabClie=' || NVL(TO_CHAR(:NEW.DTINITRCLIE, 'DD/MM/YYYY'),'');
         END IF;

         IF (NVL(:OLD.IDLIGEXTCLIE,'!') <> NVL(:NEW.IDLIGEXTCLIE,'!')) THEN
            V_DESC := V_DESC || 'IdLigacaoExternaClie=' || :NEW.IDLIGEXTCLIE;
         END IF;

         IF (NVL(TO_CHAR(:OLD.DTULTMOVCLIE,'DD/MM/YYYY'),'W') <>  NVL( TO_CHAR(:NEW.DTULTMOVCLIE,'DD/MM/YYYY'),'W')) THEN
            V_DESC := V_DESC || 'DtUltimaMovimClie=' || NVL(TO_CHAR(:NEW.DTULTMOVCLIE, 'DD/MM/YYYY'),'');
         END IF;

         IF (NVL(TO_CHAR(:OLD.DTCADACLPROS,'DD/MM/YYYY'),'W')  <> NVL( TO_CHAR(:NEW.DTCADACLPROS,'DD/MM/YYYY'),'W')) THEN
            V_DESC := V_DESC || 'DtCadastroClieProspect=' || NVL(TO_CHAR(:NEW.DTCADACLPROS,'DD/MM/YYYY'),'');
         END IF;

         IF (NVL(:OLD.VRFATUCLIE,0) <> NVL(:NEW.VRFATUCLIE,0)) THEN
            V_DESC := V_DESC || 'VrFatuBrutoAnual=' || :NEW.VRFATUCLIE;
         END IF;

         IF (NVL(:OLD.NRFUNCCLIE,'!') <> NVL(:NEW.NRFUNCCLIE,'!')) THEN
            V_DESC := V_DESC || 'NumFuncionar=' || :NEW.NRFUNCCLIE;
         END IF;

         IF (NVL(:OLD.NRUNOPCLIE,'!') <> NVL(:NEW.NRUNOPCLIE,'!')) THEN
            V_DESC := V_DESC || 'NumUnidades=' || :NEW.NRUNOPCLIE;
         END IF;

         IF (NVL(:OLD.CDQUALIF,'!') <> NVL(:NEW.CDQUALIF,'!')) THEN
            V_DESC := V_DESC || 'CodQualif=' || :NEW.CDQUALIF;
         END IF;

         IF (NVL(:OLD.QTIMPEXTRMES,0) <> NVL(:NEW.QTIMPEXTRMES,0)) THEN
            V_DESC := V_DESC || 'QtdImpressoesExtratoMes=' || :NEW.QTIMPEXTRMES;
         END IF;

         IF (NVL(:OLD.VRPEMAXDESCL,0) <> NVL(:NEW.VRPEMAXDESCL,0)) THEN
            V_DESC := V_DESC || 'PercentMaxDescClie=' || :NEW.VRPEMAXDESCL;
         END IF;

         IF (NVL(:OLD.CDMODPGTO,'!') <> NVL(:NEW.CDMODPGTO,'!')) THEN
            V_DESC := V_DESC || 'CodModalidadePgto=' || :NEW.CDMODPGTO;
         END IF;

         IF (NVL(TO_CHAR(:OLD.DTVALQUALIC, 'DD/MM/YYYY'),'W') <> NVL( TO_CHAR(:NEW.DTVALQUALIC,'DD/MM/YYYY'),'W')) THEN
            V_DESC := V_DESC || 'DtValidQualifClie=' || NVL(TO_CHAR(:NEW.DTVALQUALIC, 'DD/MM/YYYY'),'');
         END IF;

         IF (NVL(:OLD.NRNOTACLIE,0) <> NVL(:NEW.NRNOTACLIE,0)) THEN
            V_DESC := V_DESC || 'NumNFQualifForneced=' || :NEW.NRNOTACLIE;
         END IF;

         IF (NVL(:OLD.IDCLIEAUTO,'!') <> NVL(:NEW.IDCLIEAUTO,'!')) THEN
            V_DESC := V_DESC || 'IndicadorClieAutor=' || :NEW.IDCLIEAUTO;
         END IF;

         IF (NVL(:OLD.CDGRUPCLIE,'!') <> NVL(:NEW.CDGRUPCLIE,'!')) THEN
            V_DESC := V_DESC || 'CodGrupoClie=' || :NEW.CDGRUPCLIE;
         END IF;

         IF (NVL(:OLD.IDGERANFPEDI,'!') <> NVL(:NEW.IDGERANFPEDI,'!')) THEN
            V_DESC := V_DESC || 'IdGeracaoNFPedido=' || :NEW.IDGERANFPEDI;
         END IF;

         IF (NVL(:OLD.IDPFINAPRPED,'!') <> NVL(:NEW.IDPFINAPRPED,'!')) THEN
            V_DESC := V_DESC || 'IdVerifPendFinancAprovCredPed=' || :NEW.IDPFINAPRPED;
         END IF;

         IF (NVL(:OLD.NRDIAPFINAPR,'!') <> NVL(:NEW.NRDIAPFINAPR,'!')) THEN
            V_DESC := V_DESC || 'NumDiaVencPendFinancTesteAprovPed=' || :NEW.NRDIAPFINAPR;
         END IF;

         IF (NVL(:OLD.IDSFINAPRPED,'!') <> NVL(:NEW.IDSFINAPRPED,'!')) THEN
            V_DESC := V_DESC || 'IdVerifSitFinancAprovCredPed=' || :NEW.IDSFINAPRPED;
         END IF;

         IF (NVL(:OLD.IDUTCONSPEDI,'!') <> NVL(:NEW.IDUTCONSPEDI,'!')) THEN
            V_DESC := V_DESC || 'IdConsistPedido=' || :NEW.IDUTCONSPEDI;
         END IF;

         IF (NVL(:OLD.VRCAPINTFUT,0) <> NVL(:NEW.VRCAPINTFUT,0)) THEN
            V_DESC := V_DESC || 'VrCapitalIntegClie=' || :NEW.VRCAPINTFUT;
         END IF;

         IF (NVL(:OLD.VRCAPINTCLIE,0) <> NVL(:NEW.VRCAPINTCLIE,0)) THEN
            V_DESC := V_DESC || 'VrCapitClie=' || :NEW.VRCAPINTCLIE;
         END IF;

         IF (NVL(:OLD.VRRESCAPCLIE,0) <> NVL(:NEW.VRRESCAPCLIE,0)) THEN
            V_DESC := V_DESC || 'VrReservaCapitClie=' || :NEW.VRRESCAPCLIE;
         END IF;

         IF (NVL(:OLD.VRMERESTCLIE,0) <> NVL(:NEW.VRMERESTCLIE,0)) THEN
            V_DESC := V_DESC || 'VrMercadEstClie=' || :NEW.VRMERESTCLIE;
         END IF;

         IF (NVL(:OLD.CDREGIAOPED,'!') <> NVL(:NEW.CDREGIAOPED,'!')) THEN
            V_DESC := V_DESC || 'CodRegPedidos=' || :NEW.CDREGIAOPED;
         END IF;

         IF (NVL(:OLD.CDFILTABPREC,'!') <> NVL(:NEW.CDFILTABPREC,'!')) THEN
            V_DESC := V_DESC || '?=' || :NEW.CDFILTABPREC;
         END IF;

         IF (NVL(:OLD.CDTABEPREC,'!') <> NVL(:NEW.CDTABEPREC,'!')) THEN
            V_DESC := V_DESC || 'CodTabelaPrecos=' || :NEW.CDTABEPREC;
         END IF;

         IF (NVL(:OLD.CDTPINDICE,'!') <> NVL(:NEW.CDTPINDICE,'!')) THEN
            V_DESC := V_DESC || 'CodTpIndiceFinanc=' || :NEW.CDTPINDICE;
         END IF;

         IF (NVL(:OLD.CDINDICE,'!') <> NVL(:NEW.CDINDICE,'!')) THEN
            V_DESC := V_DESC || '?=' || :NEW.CDINDICE;
         END IF;

         IF (NVL(:OLD.CDCONTCTBL,'!') <> NVL(:NEW.CDCONTCTBL,'!')) THEN
            V_DESC := V_DESC || 'CodCtaContabil=' || :NEW.CDCONTCTBL;
         END IF;

         IF (NVL(:OLD.IDPERVALOR,'!') <> NVL(:NEW.IDPERVALOR,'!')) THEN
            V_DESC := V_DESC || 'IdPercentVr=' || :NEW.IDPERVALOR;
         END IF;

         IF (NVL(:OLD.CDREFERENCIA,'!') <> NVL(:NEW.CDREFERENCIA,'!')) THEN
            V_DESC := V_DESC || 'CodRef=' || :NEW.CDREFERENCIA;
         END IF;

         IF (NVL(:OLD.CDMODDOCFISC,'!') <> NVL(:NEW.CDMODDOCFISC,'!')) THEN
            V_DESC := V_DESC || 'CodModDocFisc=' || :NEW.CDMODDOCFISC;
         END IF;

         IF (NVL(:OLD.NRINSJURTRAN,'!') <> NVL(:NEW.NRINSJURTRAN,'!')) THEN
            V_DESC := V_DESC || 'NumInscJurTransport=' || :NEW.NRINSJURTRAN;
         END IF;

         IF (NVL(:OLD.IDTPIJURTRAN,'!') <> NVL(:NEW.IDTPIJURTRAN,'!')) THEN
            V_DESC := V_DESC || 'IdTpInscJurTransport=' || :NEW.IDTPIJURTRAN;
         END IF;

         IF (NVL(:OLD.CDTIPTRANS,'!') <> NVL(:NEW.CDTIPTRANS,'!')) THEN
            V_DESC := V_DESC || 'CodTpTransporte=' || :NEW.CDTIPTRANS;
         END IF;

         IF (NVL(:OLD.IDPGFRETTRANCLI,'!') <> NVL(:NEW.IDPGFRETTRANCLI,'!')) THEN
            V_DESC := V_DESC || 'IdTpPgtoFreteTransport=' || :NEW.IDPGFRETTRANCLI;
         END IF;

         IF (NVL(:OLD.IDCOMPARQXMLCLI,'!') <> NVL(:NEW.IDCOMPARQXMLCLI,'!')) THEN
            V_DESC := V_DESC || 'CompactaXML=' || :NEW.IDCOMPARQXMLCLI;
         END IF;

         IF NVL(:OLD.NRINSCSUFRAMACL, '!') <> NVL(:NEW.NRINSCSUFRAMACL, '!') THEN
            V_DESC := V_DESC || 'InscrSuframa=' || :NEW.NRINSCSUFRAMACL;
         END IF;

         IF NVL(:OLD.IDGRAVOBSCLIPED, '!') <> NVL(:NEW.IDGRAVOBSCLIPED, '!') THEN
            V_DESC := V_DESC || 'GravaObsClie=' || :NEW.IDGRAVOBSCLIPED;
         END IF;

         IF NVL(:OLD.CDCENTCUSTCLI, '!') <> NVL(:NEW.CDCENTCUSTCLI, '!') THEN
            V_DESC := V_DESC || 'CentroCusto=' || :NEW.CDCENTCUSTCLI;
         END IF;

         V_IDTIPOOPER := '2';
         V_ITPESQ := :NEW.CDCLIENTE;
      END IF;

      IF DELETING  THEN
         IF NOT ((:OLD.IDCLIEATIV) IS NULL) THEN
            IF :OLD.IDCLIEATIV = 'S' THEN
               V_IDCLIEATIV :=  'Cliente: Ativo';
            ELSE
               V_IDCLIEATIV :=  'Cliente: Inativo';
            END IF;
         END IF ;

         IF NOT( (:OLD.NRINSESTCLIE) IS NULL) THEN
            V_NRINCREST := 'Nr.Inscr.Estadual:'||' '||:OLD.NRINSESTCLIE||' ';
         END IF;

         V_DESC  := 'NrInscricao='       ||' '||:OLD.NRINSJURCLIE   ||' '||
                    'TipoInscricao='     ||' '||:OLD.IDTPIJURCLIE   ||' '||
                    'RazaoSocial='       ||' '||:OLD.NMRAZSOCCLIE   ||' '||
                    'NmFantasia='        ||' '||:OLD.NMFANTCLIE     ||' '||
                    V_NRINCREST          ||' '||V_IDCLIEATIV        ||' '||
                    'GrupoFiscal='       ||' '||:NEW.CDGRUPOFISC    ||' '||
                    'InscrSuframa='      ||' '||:NEW.NRINSCSUFRAMACL||' '||
                    'CompactaXML='       ||' '||:NEW.IDCOMPARQXMLCLI||' '||
                    'TpEnderGeracaoCFOP='||' '||:NEW.IDENDCFOPCLI   ||' '||
                    'GravaObsClie='      ||' '||:NEW.IDGRAVOBSCLIPED||' ';

         V_ITPESQ := :OLD.CDCLIENTE;
         V_IDTIPOOPER := '3';
      END IF;
   END IF;

   IF NOT (V_DESC IS NULL) THEN
      INSERT INTO LOGOPERA (NMTABELA,    DTOPERACAO,   NMRESPOPER,   IDTIPOOPER,  DSOPERACAO,
                            CDPESQITEM,  DSRDMUSUOPER, DSENDUSUOPER, DSNMUSUOPER, DSMETUSUOPER, CDORESPOPER)
                    VALUES ('CLIENTE', SYSDATE ,      NVL(V_NMOPERADOR,' '), V_IDTIPOOPER,   SUBSTR(V_DESC, 1, 300),
                            V_ITPESQ,  V_DSSERVERRDM, V_DSREMOTEADDR,        V_DSREMOTEHOST, V_DSSERVMETHOD, V_DSREMOTEOPER);
   END IF;
END;
/