ALTER TABLE CONFIGURASMTP ADD JENKCREATITEM VARCHAR2(40)
/

ALTER TABLE MUNICIPIO MODIFY CDMUNIEXPO VARCHAR2(10)
/

ALTER TABLE DOCARRECADPAG ADD DSINFOCOMPL VARCHAR2(500) NULL 
/

DECLARE
   V_SEQUENCIAL VARCHAR2(20);
BEGIN
   FOR C_MAPA IN (SELECT * FROM MAPAAPURAC
                   WHERE NRLANCTONF IS NOT NULL
                     AND NRSEQUMAPAPU NOT IN (SELECT NRSEQUMAPAPU FROM DOCARRECADPAG
                                               WHERE IDTIPOGUIA = 'M')) LOOP
      NOVO_CODIGO_NT('DOCARRECADPAG',V_SEQUENCIAL);

      INSERT INTO DOCARRECADPAG
        (NRSEQDOCARRECAD, NRSEQUMAPAPU, NRSEQUMAPAPUSN, NRSEQGUIACOMPL, CDFILIAL, NRLANCTONF, CDIMPOSTO, DTVENCIMENTO,
         CDRECEITA, CDFILIALPAG, NRLANCTONFPAG, IDTIPOGUIA, DSINFOCOMPL)
      VALUES
         (TO_NUMBER(V_SEQUENCIAL), C_MAPA.NRSEQUMAPAPU, '', '', '', '', C_MAPA.CDIMPOSTO, C_MAPA.DTVENCGUIA,
          DECODE(C_MAPA.CDIMPOSTO, '50', NVL(C_MAPA.CDRECECUMU, C_MAPA.CDRECENCUMU), '60', NVL(C_MAPA.CDRECECUMU, C_MAPA.CDRECENCUMU),C_MAPA.CDRECEGUIA),
          C_MAPA.CDFILIAL, C_MAPA.NRLANCTONF, 'M', NVL(C_MAPA.DSHISTGUIA,C_MAPA.NMMAPAAPUR));
   END LOOP;
   COMMIT;
END;