Avatar of Errang Genevre
Errang Genevre

asked on 

How to loop through the children nodes of an XML table with Oracle?

Hello,

I'm trying to figure out how to loop through multiple child nodes of the same name in an XML table; like this:

<root>
    <attributes>
        <people>
            <name>Joe</name>
            <interests>Sports</interes<wbr ></wbr>ts>
        </people>
        <people>
            <name>James</name>
            <interests>Video Games</interests>
        </people>
    </attributes>
</root>

Open in new window


I would like to get the list of people who are interested in Sports, but when I try to get the people attribute; I get an error saying the XML node had to be unique and wouldn't work unless I use the specific number; at which point it becomes a little frustrating when the node isn't always in the same place every time.

Is there any smarter way to loop through the Oracle XML table programmatically with a query?

Appreciate any help!
Oracle DatabaseDatabases

Avatar of undefined
Last Comment
flow01

8/22/2022 - Mon