-2

I´m looking for a way to get all nodes that as the same attribute on oracle xmltable using xquery ...

For example, an xmltable with a xml with employees and relate items, I would like to retrieve all modes that in the node attribute / propriety like office=344 , no only employee node , but all kind of nodes with attribute / propriety like office=344

<employee id="901" office="344"/>
<pc       id="pc901" office="344"/>

and so on ..

Mureinik
  • 297,002
  • 52
  • 306
  • 350
  • I am sorry, but I am having difficulty to understand your English. Could you please check again what you wrote and correct it in a way so that it is clear what you want to achieve? – dirkk May 28 '15 at 13:15
  • thank you I got it working by using two querys , the first get all nodes and nodes id that have office="344" on this loop for every record I do a second query to get all atributtes from witch node – António Roque May 29 '15 at 10:32

1 Answers1

0

I put a wrapper tag around your xml, but the below returns any tag with an attribute of office = 344.

SELECT *
FROM TABLE(xmlsequence(
  extract(
    xmltype('<employees><employee id="901" office="344"/>
              <pc id="pc901" office="344"/></employees>'),'/employees/*[@office=''344'']')));
Nick
  • 2,524
  • 17
  • 25
  • thank you I got it working by using two querys , the first get all nodes and nodes id that have office="344" on this loop for every record I do a second query to get all atributtes from witch node – António Roque May 29 '15 at 10:32