I want to know if there are any way to collect the parent child tag when you are creating an XMLTable. The XML is like this:
<Data>
<Identificacion/>
<UOFDATA>
<CodigoDATA v="AAAASSA"/>
<PeriodoDATA>
<IntervaloDATA v="2013-10-14/2013-10-18"/>
<UPDATA>
<CodigoDATA v="AGAGGGG"/>
<UFDATA>
<CodigoDATA v="AAASSCV"/>
<.....
I´m listings all the '/Data/UOFDATA/PeriodoDATA', and i want to know the UOFData (the parent child. I try some ways, but always return null!
Select intervalo, uof, uof2, uof3 from
XMLTable(
'/Data/UOFDATA/PeriodoDATA'
passing (select xmltype(pl_string) as xmldataselect from consultas where cdconsult = 1000)
columns Intervalo varchar2(60) path 'IntervaloDATA/@v',
UOF varchar2(60) path './ancestor::UOFDATA/CodigoDATA/@v',
UOF2 xmltype path './parent::node()',
UOF3 varchar2(60) path './../CodigoDATA/@v'
) tableIntervalo
Thanks in advance
Since you just have one parent node
CodigoDATA
but many child nodesPeriodoDATA
, I suggest you split query into 2 different ones: the first would extract the parent informationCodigoDATA
, and the second would thePeriodoDATA
child nodes (similar to what you are doing).