I have an Oracle database that has an XML field in it. Let's say I have the following fields in the table "Party":
Date Time Guest Meal
And Meal is an XML field. When I query that field, I can see the following:
<table name="dinner">
<row id="1">
<field name="main">steak</field>
<field name="side">potatoes</field>
<field name="dessert">cake</field>
</row>
</table>
How do I set up a SQL query so that it will output those individual XML field names and values as separate columns. So I want my output to be:
Date Time Guest Main Side Dessert
I have looked into XMLQUERY, but all the examples given involve node names like <Vendor></Vendor>
, not <field name = "Vendor"></field>
. I don't know how to translate those instructions.