I need to select a particular Node name in the XML file using sql string?
Sample XML structure
<Root>
<Body>
<Car> // This can be "Bike", "ship", "Train"... ect
<name value="figo"/>
</Car>
</Body>
</Root>
I want to run a query which which will fetch w开发者_StackOverflow中文版hat Node name is present in XML "car" or "Train" or "Bike".. etc.
Select * from TableA where.....?
TableA has column "Message" of type CLOB which stores the XML.
-Praveen
You can cast the CLOB type to XMLTYPE (or consider using an XMLTYPE column on the table). When dealing with XMLTYPEs you can then run XPATHs e.g:
SELECT extractvalue(xml_col, '/*/Body/*/name/@value')
FROM TableA
or extract for xml fragments.
EDIT: changed the 'Car' to * in XPath, having re-read the question.
精彩评论