XPath to get attribute names in Oracle



I have an XML file, for example:



<a b="123" c="456"/>


and I want to get all attribute names and values using xpath from Oracle SQL. Executing



select extractvalue(value(p), 'text()')
from xmltable('/*/@*' passing xmltype('<a b="123" c="456"/>')) p;


I get only ["123","456"], but I want to get ["b", "c"] too. How can I do this?


No comments:

Post a Comment