0

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

4

1 回答 1

0

由于您只有一个父节点CodigoDATA但有许多子节点PeriodoDATA,我建议您将查询拆分为 2 个不同的查询:第一个将提取父信息CodigoDATA,第二个将提取PeriodoDATA子节点(类似于您正在做的事情)。

于 2013-12-12T10:14:21.147 回答