CREATE OR REPLACE TRIGGER LOG_FIS_TIPOOPERAC
AFTER DELETE OR INSERT OR UPDATE
ON TIPOOPERAC FOR EACH ROW
DECLARE
  V_USUARIO      VARCHAR2(40);
  V_TIPO         VARCHAR2(1);
  V_ITPESQ       VARCHAR2(40);
  V_DESC         VARCHAR2(2000);    
  V_DTOPER       DATE;
  V_DSREMOTEADDR VARCHAR2(15);
  V_DSREMOTEHOST VARCHAR2(15);
  V_DSSERVERRDM  VARCHAR2(20);
  V_DSSERVMETHOD VARCHAR2(30);
  V_DSREMOTEOPER VARCHAR2(12);
  V_TAM          INTEGER;
BEGIN
   V_TIPO := '0';
   V_DESC := '';

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

   IF DELETING THEN
      IF :OLD.IDENTRSAIDOP IS NOT NULL THEN
         V_DESC := V_DESC || 'E/S=' || :OLD.IDENTRSAIDOP;
      END IF;

      IF :OLD.IDUTCTRLAIDF IS NOT NULL THEN
         V_DESC := V_DESC || ' CtrlAidf=' || :OLD.IDUTCTRLAIDF;
      END IF;

      IF :OLD.CDIMPOSTOIPI IS NOT NULL THEN
         V_DESC := V_DESC || ' ImpostoIpi=' || :OLD.CDIMPOSTOIPI;
      END IF;

      IF :OLD.CDENCARGOICMST IS NOT NULL THEN
         V_DESC := V_DESC || ' EncargoIcms=' || :OLD.CDENCARGOICMST;
      END IF;

      IF :OLD.IDOBINFCSTICMENT IS NOT NULL THEN
         V_DESC := V_DESC || ' ObrigaICMSEnt=' || :OLD.IDOBINFCSTICMENT;
      END IF;

      IF :OLD.IDOBINFCSTCFOPEN IS NOT NULL THEN
         V_DESC := V_DESC || ' ObrigaCFOPEnt=' || :OLD.IDOBINFCSTCFOPEN;
      END IF;

      IF :OLD.IDGERICMSTDESPA IS NOT NULL THEN
         V_DESC := V_DESC || ' GeraICMSSTDespAces=' || :OLD.IDGERICMSTDESPA;
      END IF;

      IF :OLD.IDPEINFICMSTDEME IS NOT NULL THEN
         V_DESC := V_DESC || ' PermitInfICMSTDevo=' || :OLD.IDPEINFICMSTDEME;
      END IF;

      IF :OLD.IDGERIPIDESPA IS NOT NULL THEN
         V_DESC := V_DESC || ' GeraIPIDespAces=' || :OLD.IDGERIPIDESPA;
      END IF;

      IF :OLD.IDCOAVRIMPVRPROD IS NOT NULL THEN
         V_DESC := V_DESC || ' IdCoaCrImpVrProd=' || :OLD.IDCOAVRIMPVRPROD;
      END IF;

      IF :OLD.IDNOTADEVO IS NOT NULL THEN
         V_DESC := V_DESC || ' NotaDevo=' || :OLD.IDNOTADEVO;
      END IF;

      IF :OLD.IDUTRECEITA IS NOT NULL THEN
         V_DESC := V_DESC || ' UtReceita=' || :OLD.IDUTRECEITA;
      END IF;

      IF :OLD.IDUTILNFSE IS NOT NULL THEN
         V_DESC := V_DESC || ' UtilNfSe=' || :OLD.IDUTILNFSE;
      END IF;

      IF :OLD.IDUTILOPEROFF IS NOT NULL THEN
         V_DESC := V_DESC || ' UtilOperOff=' || :OLD.IDUTILOPEROFF;
      END IF;

      IF :OLD.IDUTCUSORIGEST IS NOT NULL THEN
         V_DESC := V_DESC || ' UtCusOrigEst=' || :OLD.IDUTCUSORIGEST;
      END IF;

      IF :OLD.CDFORNECEDPADR IS NOT NULL THEN
         V_DESC := V_DESC || ' FornecedPadr=' || :OLD.CDFORNECEDPADR;
      END IF;

      IF :OLD.DSOPERNFAVISTA IS NOT NULL THEN
         V_DESC := V_DESC || ' OperNfAvista=' || :OLD.DSOPERNFAVISTA;
      END IF;

      IF :OLD.IDINFCPFCNPJNF IS NOT NULL THEN
         V_DESC := V_DESC || ' InfCpfCnpjNf=' || :OLD.IDINFCPFCNPJNF;
      END IF;

      IF :OLD.CDCTBLTPOPERCMV IS NOT NULL THEN
         V_DESC := V_DESC || ' CtBlTOperCMV=' || :OLD.CDCTBLTPOPERCMV;
      END IF;

      IF :OLD.CDREFLOTECTBTO IS NOT NULL THEN
         V_DESC := V_DESC || ' RefLoteCtBto=' || :OLD.CDREFLOTECTBTO;
      END IF;

      IF :OLD.IDCONSPARFIS IS NOT NULL THEN
         V_DESC := V_DESC || ' ConsParFis=' || :OLD.IDCONSPARFIS;
      END IF;

      IF :OLD.IDGERAVENCNFAP IS NOT NULL THEN
         V_DESC := V_DESC || ' GeraVencNfap=' || :OLD.IDGERAVENCNFAP;
      END IF;

      IF :OLD.IDCONSCTBRAT IS NOT NULL THEN
         V_DESC := V_DESC || ' ConsCtBrat=' || :OLD.IDCONSCTBRAT;
      END IF;

      IF :OLD.IDUTILOPERFAMAN IS NOT NULL THEN
         V_DESC := V_DESC || ' UtilOperFam=' || :OLD.IDUTILOPERFAMAN;
      END IF;

      IF :OLD.IDUTILVENCOBR IS NOT NULL THEN
         V_DESC := V_DESC || ' UtilVenc=' || :OLD.IDUTILVENCOBR;
      END IF;

      IF :OLD.IDSERIEAUTO IS NOT NULL THEN
         V_DESC := V_DESC || ' SerAuto=' || :OLD.IDSERIEAUTO;
      END IF;

      IF :OLD.IDGERADUPLI IS NOT NULL THEN
         V_DESC := V_DESC || 'GeraDupli=' || :OLD.IDGERADUPLI;
      END IF;

      IF :OLD.IDCOMPEMISRE IS NOT NULL THEN
         V_DESC := V_DESC || 'CompEmis=' || :OLD.IDCOMPEMISRE;
      END IF;

      IF :OLD.IDCOMPGERTG IS NOT NULL THEN
         V_DESC := V_DESC || 'CompGer=' || :OLD.IDCOMPGERTG;
      END IF;

      IF :OLD.IDPERALTDSEM IS NOT NULL THEN
         V_DESC := V_DESC || ' IDPERALTDSEM=' || :OLD.IDPERALTDSEM;
      END IF;

      IF :OLD.IDDCORIGRELAC IS NOT NULL THEN
         V_DESC := V_DESC || ' IDDCORIGRELAC=' || :OLD.IDDCORIGRELAC;
      END IF;

      IF :OLD.IDCOMPRESROP IS NOT NULL THEN
         V_DESC := V_DESC || ' CompEsRop=' || :OLD.IDCOMPRESROP;
      END IF;

      IF :OLD.IDCOMPDOCROP IS NOT NULL THEN
         V_DESC := V_DESC || ' CompDocRop=' || :OLD.IDCOMPDOCROP;
      END IF;

      IF :OLD.DSTIPOOPEFAT IS NOT NULL THEN
         V_DESC := V_DESC || ' TipOpFat=' || :OLD.DSTIPOOPEFAT;
      END IF;

      IF :OLD.CDTPCTPAGAR IS NOT NULL THEN
         V_DESC := V_DESC || ' TpCtPagar=' || :OLD.CDTPCTPAGAR;
      END IF;

      IF :OLD.CDTPCTRECEB IS NOT NULL THEN
         V_DESC := V_DESC || ' TpCtReceb=' || :OLD.CDTPCTRECEB;
      END IF;

      IF :OLD.CDTIPOOPER IS NOT NULL THEN
         V_DESC := V_DESC || ' Cod=' || :OLD.CDTIPOOPER;
      END IF;

      IF :OLD.NMTIPOOPER IS NOT NULL THEN
         V_DESC := V_DESC || ' Nome=' || :OLD.NMTIPOOPER;
      END IF;

      IF :OLD.IDUTILOPER IS NOT NULL THEN
         V_DESC := V_DESC || ' UtilDFE=' || :OLD.IDUTILOPER;
      END IF;

      IF :OLD.CDEXTIPOOPER IS NOT NULL THEN
         V_DESC := V_DESC || ' CDExpor=' || :OLD.CDEXTIPOOPER;
      END IF;

      IF :OLD.IDORIGDESTOP IS NOT NULL THEN
         V_DESC := V_DESC || ' Origem=' || :OLD.IDORIGDESTOP;
      END IF;

      IF :OLD.IDGERANFCMP IS NOT NULL THEN
         V_DESC := V_DESC || ' GeraNvComp=' || :OLD.IDGERANFCMP;
      END IF;

      IF :OLD.CDTIPOCUSTO IS NOT NULL THEN
         V_DESC := V_DESC || ' TpCusto=' || :OLD.CDTIPOCUSTO;
      END IF;

      IF :OLD.CDPRECOBASE IS NOT NULL THEN
         V_DESC := V_DESC || ' TabPreco=' || :OLD.CDPRECOBASE;
      END IF;

      IF :OLD.IDUTILVENC IS NOT NULL THEN
         V_DESC := V_DESC || ' UtilVenc=' || :OLD.IDUTILVENC;
      END IF;

      IF :OLD.IDUTILEMISNF IS NOT NULL THEN
         V_DESC := V_DESC || ' UtilEmisNF=' || :OLD.IDUTILEMISNF;
      END IF;

      IF :OLD.IDPERNUMENF IS NOT NULL THEN
         V_DESC := V_DESC || ' NumLancNF=' || :OLD.IDPERNUMENF;
      END IF;

      IF :OLD.IDGERAVENC IS NOT NULL THEN
         V_DESC := V_DESC || ' VencAutom=' || :OLD.IDGERAVENC;
      END IF;

      IF :OLD.IDATUESTTPOP IS NOT NULL THEN
         V_DESC := V_DESC || ' AtuallEst=' || :OLD.IDATUESTTPOP;
      END IF;

      IF :OLD.IDOPERDEVONF IS NOT NULL THEN
         V_DESC := V_DESC || ' UtilDocOrg=' || :OLD.IDOPERDEVONF;
      END IF;

      IF :OLD.IDNFORIGOBRI IS NOT NULL THEN
         V_DESC := V_DESC || ' DocOrgObrig=' || :OLD.IDNFORIGOBRI;
      END IF;

      IF :OLD.IDUTLLISTORI IS NOT NULL THEN
         V_DESC := V_DESC || ' UtPesqList=' || :OLD.IDUTLLISTORI;
      END IF;

      IF :OLD.DSOPERNFORIG IS NOT NULL THEN
         V_DESC := V_DESC || ' DocOrg=' || :OLD.DSOPERNFORIG;
      END IF;

      IF :OLD.CDCONTFORCLI IS NOT NULL THEN
         V_DESC := V_DESC || ' Forn/Cli=' || :OLD.CDCONTFORCLI;
      END IF;

      IF :OLD.CDCONTPROD IS NOT NULL THEN
         V_DESC := V_DESC || ' Prod=' || :OLD.CDCONTPROD;
      END IF;

      IF :OLD.IDCONTABOPER IS NOT NULL THEN
         V_DESC := V_DESC || ' Contab=' || :OLD.IDCONTABOPER;
      END IF;

      IF :OLD.IDDTCONTAB IS NOT NULL THEN
         V_DESC := V_DESC || ' DtContab=' || :OLD.IDDTCONTAB;
      END IF;

      IF :OLD.IDTPOPVENDA IS NOT NULL THEN
         V_DESC := V_DESC || ' Venda=' || :OLD.IDTPOPVENDA;
      END IF;

      IF :OLD.CDHISTPADR IS NOT NULL THEN
         V_DESC := V_DESC || ' Hist=' || :OLD.CDHISTPADR;
      END IF;

      IF :OLD.CDGRUPOFISC IS NOT NULL THEN
         V_DESC := V_DESC || ' GrupFisc=' || :OLD.CDGRUPOFISC;
      END IF;

      IF :OLD.IDUTGERNFTRAN IS NOT NULL THEN
         V_DESC := V_DESC || ' UtNfTransf=' || :OLD.IDUTGERNFTRAN;
      END IF;

      IF :OLD.IDTPTRANSNFE IS NOT NULL THEN
         V_DESC := V_DESC || ' TpOpTransNFE=' || :OLD.IDTPTRANSNFE;
      END IF;

      IF :OLD.IDBRINDETPOPER IS NOT NULL THEN
         V_DESC := V_DESC || ' BrindeTpOp=' || :OLD.IDBRINDETPOPER;
      END IF;

      IF :OLD.IDNFESTCANC IS NOT NULL THEN
         V_DESC := V_DESC || ' EstornoCanc=' || :OLD.IDNFESTCANC;
      END IF;

      IF :OLD.IDNFPRESTSERV IS NOT NULL THEN
         V_DESC := V_DESC || ' NFPrestServ=' || :OLD.IDNFPRESTSERV;
      END IF;

	     IF :OLD.IDNFAJUSTE IS NOT NULL THEN
         V_DESC := V_DESC || ' NFAjuste=' || :OLD.IDNFAJUSTE;
      END IF;

      IF :OLD.IDTRATRECBRUTA IS NOT NULL THEN
         V_DESC := V_DESC || ' TratReceitaBR=' || :OLD.IDTRATRECBRUTA;
      END IF;

      IF :OLD.IDOPERDEVOOL IS NOT NULL THEN
         V_DESC := V_DESC || ' IdOperDevolOL=' || :OLD.IDOPERDEVOOL;
      END IF;

      IF :OLD.IDTIPOOPERELE IS NOT NULL THEN
         V_DESC := V_DESC || ' TipoOpNfe=' || :OLD.IDTIPOOPERELE;
      END IF;

      IF :OLD.IDOBRDTREFFAT IS NOT NULL THEN
         V_DESC := V_DESC || ' ObrDtRefFat=' || :OLD.IDOBRDTREFFAT;
      END IF;

      IF :OLD.IDALTDTREFAPROV IS NOT NULL THEN
         V_DESC := V_DESC || ' AltDtRefAprov=' || :OLD.IDALTDTREFAPROV;
      END IF;

      IF :OLD.IDCONTSOMENIMPO IS NOT NULL THEN
         V_DESC := V_DESC || ' ContSomenImpo='|| :OLD.IDCONTSOMENIMPO;
      END IF;

      IF :OLD.IDNFRETIND IS NOT NULL THEN
         V_DESC := V_DESC || ' IdNfRetInd='|| :OLD.IDNFRETIND;
      END IF;

      IF :OLD.IDOPTRIANGULAR IS NOT NULL THEN
         V_DESC := V_DESC || ' IdOpTriangular='|| :OLD.IDOPTRIANGULAR;
      END IF;

      IF :OLD.IDENTRTERCEIRO IS NOT NULL THEN
         V_DESC := V_DESC || ' IdEntrTerceiro='|| :OLD.IDENTRTERCEIRO;
      END IF;

      IF :OLD.IDREMESSAINDU IS NOT NULL THEN
         V_DESC := V_DESC || ' IdRemessaIndu='|| :OLD.IDREMESSAINDU;
      END IF;

      IF :OLD.IDCALCDIFALDENT IS NOT NULL THEN
         V_DESC := V_DESC || ' IdCalcDifalDent='|| :OLD.IDCALCDIFALDENT;
      END IF;

      IF :OLD.IDCONSFISCPROD IS NOT NULL THEN
         V_DESC := V_DESC || ' ConsFiscProd='|| :OLD.IDCONSFISCPROD;
      END IF;

      IF :OLD.IDCONSANACONC IS NOT NULL THEN
         V_DESC := V_DESC || ' IDConsAnaConc='|| :OLD.IDCONSANACONC;
      END IF;

      IF :OLD.IDREMEINSUAPROV IS NOT NULL THEN
         V_DESC := V_DESC || ' IDRemeInsuAprov='|| :OLD.IDREMEINSUAPROV;
      END IF;

	     IF :OLD.IDREARATMANNF IS NOT NULL THEN
         V_DESC := V_DESC || ' IDReaRatManual='|| :OLD.IDREARATMANNF;
      END IF;

	     IF :OLD.IDNTRANSCREICMS IS NOT NULL THEN
         V_DESC := V_DESC || ' IDPortCAT37='|| :OLD.IDNTRANSCREICMS;
      END IF;

      IF :OLD.CDTIPOOPERBONIF IS NOT NULL THEN
         V_DESC := V_DESC || ' Cdtipooperbonif='|| :OLD.CDTIPOOPERBONIF;
      END IF;

      IF :OLD.IDNFSTMANUAL IS NOT NULL THEN
         V_DESC := V_DESC || ' NFRessarcSTManu='|| :OLD.IDNFSTMANUAL;
      END IF;

      IF :OLD.IDIMPDSPRODEMIS IS NOT NULL THEN
         V_DESC := V_DESC || ' IDImpDsProdEmisNFServ='|| :OLD.IDIMPDSPRODEMIS;
      END IF;


      V_TIPO         := '3';
      V_ITPESQ       := :OLD.IDENTRSAIDOP||:OLD.CDTIPOOPER;
   ELSE
      IF UPDATING THEN
         IF (NVL(:OLD.IDENTRSAIDOP,'!') <> NVL(:NEW.IDENTRSAIDOP,'!'))         OR
            (NVL(:OLD.IDGERIPIDESPA,'!') <> NVL(:NEW.IDGERIPIDESPA,'!'))       OR
            (NVL(:OLD.IDUTCTRLAIDF,'!') <> NVL(:NEW.IDUTCTRLAIDF,'!'))         OR
            (NVL(:OLD.CDIMPOSTOIPI,'!') <> NVL(:NEW.CDIMPOSTOIPI,'!'))         OR
            (NVL(:OLD.CDENCARGOICMST,'!') <> NVL(:NEW.CDENCARGOICMST,'!'))     OR
            (NVL(:OLD.IDPEINFICMSTDEME,'!') <> NVL(:NEW.IDPEINFICMSTDEME,'!')) OR
            (NVL(:OLD.IDGERICMSTDESPA,'!') <> NVL(:NEW.IDGERICMSTDESPA,'!'))   OR
            (NVL(:OLD.IDOBINFCSTCFOPEN,'!') <> NVL(:NEW.IDOBINFCSTCFOPEN,'!')) OR
            (NVL(:OLD.IDOBINFCSTICMENT,'!') <> NVL(:NEW.IDOBINFCSTICMENT,'!')) OR
            (NVL(:OLD.IDCOAVRIMPVRPROD,'!') <> NVL(:NEW.IDCOAVRIMPVRPROD,'!')) OR
            (NVL(:OLD.IDNOTADEVO,'!') <> NVL(:NEW.IDNOTADEVO,'!'))             OR
            (NVL(:OLD.IDUTRECEITA,'!') <> NVL(:NEW.IDUTRECEITA,'!'))           OR
            (NVL(:OLD.IDUTILNFSE,'!') <> NVL(:NEW.IDUTILNFSE,'!'))             OR
            (NVL(:OLD.IDUTILOPEROFF,'!') <> NVL(:NEW.IDUTILOPEROFF,'!'))       OR
            (NVL(:OLD.IDUTCUSORIGEST,'!') <> NVL(:NEW.IDUTCUSORIGEST,'!'))     OR
            (NVL(:OLD.DSOPERNFAVISTA,'!') <> NVL(:NEW.DSOPERNFAVISTA,'!'))     OR
            (NVL(:OLD.IDINFCPFCNPJNF,'!') <> NVL(:NEW.IDINFCPFCNPJNF,'!'))     OR
            (NVL(:OLD.CDCTBLTPOPERCMV,'!') <> NVL(:NEW.CDCTBLTPOPERCMV,'!'))   OR
            (NVL(:OLD.CDREFLOTECTBTO,'!') <> NVL(:NEW.CDREFLOTECTBTO,'!'))     OR
            (NVL(:OLD.IDCONSPARFIS,'!') <> NVL(:NEW.IDCONSPARFIS,'!'))         OR
            (NVL(:OLD.IDGERAVENCNFAP,'!') <> NVL(:NEW.IDGERAVENCNFAP,'!'))     OR
            (NVL(:OLD.IDCONSCTBRAT,'!') <> NVL(:NEW.IDCONSCTBRAT,'!'))         OR
            (NVL(:OLD.IDUTILOPERFAMAN,'!') <> NVL(:NEW.IDUTILOPERFAMAN,'!'))   OR
            (NVL(:OLD.IDUTILVENCOBR,'!') <> NVL(:NEW.IDUTILVENCOBR,'!'))       OR
            (NVL(:OLD.IDSERIEAUTO,'!') <> NVL(:NEW.IDSERIEAUTO,'!'))           OR
            (NVL(:OLD.IDGERADUPLI,'!') <> NVL(:NEW.IDGERADUPLI,'!'))           OR
            (NVL(:OLD.IDCOMPEMISRE,'!') <> NVL(:NEW.IDCOMPEMISRE,'!'))         OR
            (NVL(:OLD.IDCOMPGERTG,'!') <> NVL(:NEW.IDCOMPGERTG,'!'))           OR
            (NVL(:OLD.IDPERALTDSEM,'!') <> NVL(:NEW.IDPERALTDSEM,'!'))         OR
            (NVL(:OLD.IDDCORIGRELAC,'!') <> NVL(:NEW.IDDCORIGRELAC,'!'))       OR
            (NVL(:OLD.IDCOMPRESROP,'!') <> NVL(:NEW.IDCOMPRESROP,'!'))         OR
            (NVL(:OLD.IDCOMPDOCROP,'!') <> NVL(:NEW.IDCOMPDOCROP,'!'))         OR
            (NVL(:OLD.DSTIPOOPEFAT,'!') <> NVL(:NEW.DSTIPOOPEFAT,'!'))         OR
            (NVL(:OLD.CDTPCTPAGAR,'!') <> NVL(:NEW.CDTPCTPAGAR,'!'))           OR
            (NVL(:OLD.CDTPCTRECEB,'!') <> NVL(:NEW.CDTPCTRECEB,'!'))           OR
            (NVL(:OLD.CDTIPOOPER,'!')   <> NVL(:NEW.CDTIPOOPER,'!'))           OR
            (NVL(:OLD.IDUTILOPER,'!')   <> NVL(:NEW.IDUTILOPER,'!'))           OR
            (NVL(:OLD.NMTIPOOPER,'!')   <> NVL(:NEW.NMTIPOOPER,'!'))           OR
            (NVL(:OLD.CDEXTIPOOPER,'!') <> NVL(:NEW.CDEXTIPOOPER,'!'))         OR
            (NVL(:OLD.IDORIGDESTOP,'!') <> NVL(:NEW.IDORIGDESTOP,'!'))         OR
            (NVL(:OLD.IDGERANFCMP,'!')  <> NVL(:NEW.IDGERANFCMP,'!'))          OR
            (NVL(:OLD.CDTIPOCUSTO,'!')  <> NVL(:NEW.CDTIPOCUSTO,'!'))          OR
            (NVL(:OLD.CDPRECOBASE,'!')  <> NVL(:NEW.CDPRECOBASE,'!'))          OR
            (NVL(:OLD.IDUTILVENC,'!')   <> NVL(:NEW.IDUTILVENC,'!'))           OR
            (NVL(:OLD.IDUTILEMISNF,'!') <> NVL(:NEW.IDUTILEMISNF,'!'))         OR
            (NVL(:OLD.IDPERNUMENF,'!')  <> NVL(:NEW.IDPERNUMENF,'!'))          OR
            (NVL(:OLD.IDGERAVENC,'!')   <> NVL(:NEW.IDGERAVENC,'!'))           OR
            (NVL(:OLD.IDATUESTTPOP,'!') <> NVL(:NEW.IDATUESTTPOP,'!'))         OR
            (NVL(:OLD.IDOPERDEVONF,'!') <> NVL(:NEW.IDOPERDEVONF,'!'))         OR
            (NVL(:OLD.IDNFORIGOBRI,'!') <> NVL(:NEW.IDNFORIGOBRI,'!'))         OR
            (NVL(:OLD.IDUTLLISTORI,'!') <> NVL(:NEW.IDUTLLISTORI,'!'))         OR
            (NVL(:OLD.DSOPERNFORIG,'!') <> NVL(:NEW.DSOPERNFORIG,'!'))         OR
            (NVL(:OLD.CDCONTFORCLI,'!') <> NVL(:NEW.CDCONTFORCLI,'!'))         OR
            (NVL(:OLD.CDCONTPROD,'!')   <> NVL(:NEW.CDCONTPROD,'!'))           OR
            (NVL(:OLD.IDCONTABOPER,'!') <> NVL(:NEW.IDCONTABOPER,'!'))         OR
            (NVL(:OLD.IDDTCONTAB,'!')   <> NVL(:NEW.IDDTCONTAB,'!'))           OR
            (NVL(:OLD.IDTPOPVENDA,'!')  <> NVL(:NEW.IDTPOPVENDA,'!'))          OR
            (NVL(:OLD.CDHISTPADR,'!')   <> NVL(:NEW.CDHISTPADR,'!'))           OR
            (NVL(:OLD.CDGRUPOFISC,'!')  <> NVL(:NEW.CDGRUPOFISC,'!'))          OR
            (NVL(:OLD.IDTPTRANSNFE,'!') <> NVL(:NEW.IDTPTRANSNFE,'!'))         OR
            (NVL(:OLD.IDBRINDETPOPER,'!') <> NVL(:NEW.IDBRINDETPOPER,'!'))     OR
            (NVL(:OLD.IDUTGERNFTRAN,'!')  <> NVL(:NEW.IDUTGERNFTRAN,'!'))      OR
            (NVL(:OLD.IDNFESTCANC,'!')    <> NVL(:NEW.IDNFESTCANC,'!'))        OR
            (NVL(:OLD.IDNFAJUSTE,'!')    <> NVL(:NEW.IDNFAJUSTE,'!'))          OR
            (NVL(:OLD.IDNFPRESTSERV,'!')  <> NVL(:NEW.IDNFPRESTSERV,'!'))      OR
            (NVL(:OLD.IDTRATRECBRUTA, '!') <> NVL(:NEW.IDTRATRECBRUTA, '!'))   OR
            (NVL(:OLD.IDOPERDEVOOL,'!')     <> NVL(:NEW.IDOPERDEVOOL,'!'))     OR
            (NVL(:OLD.IDTIPOOPERELE, '!') <> NVL(:NEW.IDTIPOOPERELE, '!'))     OR
            (NVL(:OLD.IDOBRDTREFFAT, '!') <> NVL(:NEW.IDOBRDTREFFAT, '!'))     OR
            (NVL(:OLD.IDALTDTREFAPROV, '!') <> NVL(:NEW.IDALTDTREFAPROV, '!')) OR
            (NVL(:OLD.IDCONTSOMENIMPO, '!') <> NVL(:NEW.IDCONTSOMENIMPO, '!')) OR
            (NVL(:OLD.IDNFRETIND, '!') <> NVL(:NEW.IDNFRETIND, '!'))           OR
            (NVL(:OLD.IDOPTRIANGULAR, '!') <> NVL(:NEW.IDOPTRIANGULAR, '!'))   OR
            (NVL(:OLD.IDENTRTERCEIRO, '!') <> NVL(:NEW.IDENTRTERCEIRO, '!'))   OR
            (NVL(:OLD.IDREMESSAINDU, '!') <> NVL(:NEW.IDREMESSAINDU, '!'))     OR
            (NVL(:OLD.IDCONSFISCPROD, '!') <> NVL(:NEW.IDCONSFISCPROD, '!'))   OR
            (NVL(:OLD.IDCALCDIFALDENT, '!') <> NVL(:NEW.IDCALCDIFALDENT, '!')) OR
            (NVL(:OLD.IDCONSANACONC, '!') <> NVL(:NEW.IDCONSANACONC, '!'))     OR
            (NVL(:OLD.IDREARATMANNF, '!') <> NVL(:NEW.IDREARATMANNF, '!'))     OR
            (NVL(:OLD.IDNTRANSCREICMS, '!') <> NVL(:NEW.IDNTRANSCREICMS, '!')) OR
            (NVL(:OLD.IDREMEINSUAPROV, '!') <> NVL(:NEW.IDREMEINSUAPROV, '!')) OR
            (NVL(:OLD.CDTIPOOPERBONIF, '!') <> NVL(:NEW.CDTIPOOPERBONIF, '!')) OR
            (NVL(:OLD.IDNFSTMANUAL, '!') <> NVL(:NEW.IDNFSTMANUAL, '!'))       OR
            (NVL(:OLD.IDIMPDSPRODEMIS, '!') <> NVL(:NEW.IDIMPDSPRODEMIS, '!')) THEN

               V_TIPO         := '2';
               V_ITPESQ       := :OLD.IDENTRSAIDOP||:OLD.CDTIPOOPER;
         END IF;
      ELSE
         V_TIPO         := '1';
         V_ITPESQ       := :NEW.IDENTRSAIDOP||:NEW.CDTIPOOPER;
      END IF;

      IF NVL(:NEW.IDENTRSAIDOP, '!') <> NVL(:OLD.IDENTRSAIDOP, '!')       THEN
         V_DESC := V_DESC || ' E/S=' || :NEW.IDENTRSAIDOP;
      END IF;

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

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

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

      IF NVL(:OLD.IDOBINFCSTICMENT,'!') <> NVL(:NEW.IDOBINFCSTICMENT,'!') THEN
         V_DESC := V_dESC || ' ObrigaICMSEnt=' || :NEW.IDOBINFCSTICMENT;
      END IF;

      IF NVL(:OLD.IDOBINFCSTCFOPEN,'!') <> NVL(:NEW.IDOBINFCSTCFOPEN,'!') THEN
         V_DESC := V_dESC || ' ObrigaCFOPEnt=' || :NEW.IDOBINFCSTCFOPEN;
      END IF;

      IF NVL(:OLD.IDGERICMSTDESPA,'!') <> NVL(:NEW.IDGERICMSTDESPA,'!')   THEN
         V_DESC := V_dESC || ' GeraICMSSTDespAces=' || :NEW.IDGERICMSTDESPA;
      END IF;

      IF NVL(:OLD.IDPEINFICMSTDEME,'!') <> NVL(:NEW.IDPEINFICMSTDEME,'!') THEN
         V_DESC := V_dESC || ' PermitInfICMSTDevo=' || :NEW.IDPEINFICMSTDEME;
      END IF;

      IF NVL(:OLD.IDGERIPIDESPA,'!') <> NVL(:NEW.IDGERIPIDESPA,'!')       THEN
         V_DESC := V_dESC || ' GeraIPIDespAces=' || :NEW.IDGERIPIDESPA;
      END IF;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      IF NVL(:NEW.CDCONTFORCLI, '!') <> NVL(:OLD.CDCONTFORCLI, '!')       THEN
           V_DESC := V_DESC || ' Forn/Cli=' || :NEW.CDCONTFORCLI;
      END IF;

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

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

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

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

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

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

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

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

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

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

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

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

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

      IF NVL(:OLD.IDOPERDEVOOL,'!') <> NVL(:NEW.IDOPERDEVOOL,'!')         THEN
         V_DESC := V_dESC || ' IdOperDevoOL=' || :NEW.IDOPERDEVOOL;
      END IF;

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

      IF NVL(:OLD.IDOBRDTREFFAT,'!') <> NVL(:NEW.IDOBRDTREFFAT,'!')       THEN
         V_DESC := V_dESC || ' ObrDtRefFat=' || :NEW.IDOBRDTREFFAT;
      END IF;

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

      IF NVL(:NEW.IDCONTSOMENIMPO, '!') <> NVL(:OLD.IDCONTSOMENIMPO, '!') THEN
         V_DESC := V_DESC || ' ContSomenImpo=' || :NEW.IDCONTSOMENIMPO;
      END IF;
      
      IF NVL(:NEW.IDNFRETIND, '!') <> NVL(:OLD.IDNFRETIND, '!')           THEN
         V_DESC := V_DESC || ' IdNfRetInd=' || :NEW.IDNFRETIND;
      END IF;

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

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

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

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

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

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

      IF NVL(:NEW.IDREMEINSUAPROV, '!') <> NVL(:OLD.IDREMEINSUAPROV, '!')     THEN
         V_DESC := V_DESC || ' IDRemeInsuAprov=' || :NEW.IDREMEINSUAPROV;
      END IF;
	  
	     IF NVL(:NEW.IDREARATMANNF, '!') <> NVL(:OLD.IDREARATMANNF, '!')     THEN
         V_DESC := V_DESC || ' IDReaRatManual=' || :NEW.IDREARATMANNF;
      END IF;
	  
	     IF NVL(:NEW.IDNTRANSCREICMS, '!') <> NVL(:OLD.IDNTRANSCREICMS, '!')     THEN
         V_DESC := V_DESC || ' IDPortCAT37=' || :NEW.IDNTRANSCREICMS;
      END IF;

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

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

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

   END IF;

   IF V_TIPO <> '0' THEN
      NMUSUARIO(V_USUARIO);

      V_DTOPER := SYSDATE;
      V_TAM := LENGTH(V_DESC);
      WHILE (V_TAM >= 0) LOOP
         INSERT INTO LOGOPERA
            (NMTABELA,     DTOPERACAO,   NMRESPOPER,  IDTIPOOPER,   CDPESQITEM,  DSOPERACAO,
             DSRDMUSUOPER, DSENDUSUOPER, DSNMUSUOPER, DSMETUSUOPER, CDORESPOPER)
         VALUES
            ('TIPOOPERAC',   V_DTOPER,       V_USUARIO,     V_TIPO,         V_ITPESQ,       SUBSTR(V_DESC,1,400),
             V_DSREMOTEADDR, V_DSREMOTEHOST, V_DSSERVERRDM, V_DSSERVMETHOD, V_DSREMOTEOPER);
         V_DESC := SUBSTR(V_DESC, 400, V_TAM);
         V_TAM := LENGTH(V_DESC);
      END LOOP;
   END IF;
END;
/