MySql query to retrieve value of element attribute of xml
I have mysql table (say TestSuite), holding xml content (although as long text) in TestSuiteDefinition column,
<test_suite id="368">
<name>TestSuite1</name>
<description>TestSuite</description>
<test_case id="141" version="" />
<test_case id="142" version="" />
<test_case id="143" version="" />
<test_case id="144" version="" />
</test_suite>
now, I want to retrieve the value of attributes ("id" in this case). I know how to do it in MS SQL e.g:
SELECT TestSuiteDefinition.query('data(/test_suite/test_case/@id)') as name FROM TestSuite WHERE TestSuiteId='368'
But not able to figure it out in MySQL. Note: Tried MySQL function ExtractValue() but no success on retrieving element attributes. Thanks
Subject
Written By
Posted
MySql query to retrieve value of element attribute of xml
March 30, 2015 04:43AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.