Hi,
I have a XML with many items.
Ex:
<NFe xmlns="http://www.portalfiscal.inf.br/nfe">
<infNFe Id="NFe31180233014556088425550010032448791402099625" versao="3.10">
<det nItem="1">
<prod>
<cProd>000000000004257834</cProd>
<cEAN>7899618824046</cEAN>
<xProd>CUECA BOXER SCOST P 257 DUOMO</xProd>
<NCM>61071200</NCM>
<vProd>154.42</vProd>
</prod>
</det>
<det nItem="2">
<prod>
<cProd>000000000004271976</cProd>
<cEAN>6942685633118</cEAN>
<xProd>SOUTIEN ALCA REMOV B+ YG009 RENDA PTO</xProd>
<NCM>62121000</NCM>
<vProd>150.13</vProd>
</prod>
</det>
<det nItem="3">
<prod>
<cProd>000000000004272016</cProd>
<cEAN>6942685633200</cEAN>
<xProd>SOUTIEN B+ YG012 C RENDA CEREJA</xProd>
<NCM>62121000</NCM>
<vProd>150.13</vProd>
</prod>
</det>
</infNFe>
</NFe>
I need to extract the values of the "nItem" attribute concatenated by ";" in one string.
The result should be:
1;2;3
But I'm getting
123
The column name is xml_documento (it's a xml type).
I'm using:
XMLAGG(xml_documento).EXTRACT ('//det/@nItem','xmlns="http://www.portalfiscal.inf.br/nfe"').getClobVal()
Can't use LISTAGG cause the result's length is bigger then 4000 characters and throws me the ORA-01489: result of string concatenation is too long.
I supose I can add conditions to the expression "//det/@nItem" as the EXTRACT parameter, but don't know how.
Need the ";" between each value.
Any help?
Thanks in advance!
José Neto