MySQL Forums
Forum List  »  Newbie

Re: MySql query to retrieve value of element attribute of xml
Posted by: Rick James
Date: March 31, 2015 06:39PM

Maybe this:

mysql> SET @xml = '<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> ';

mysql> SELECT ExtractValue(@xml, '/test_suite/test_case/@id');
+-------------------------------------------------+
| ExtractValue(@xml, '/test_suite/test_case/@id') |
+-------------------------------------------------+
| 141 142 143 144                                 |
+-------------------------------------------------+

Options: ReplyQuote


Subject
Written By
Posted
Re: MySql query to retrieve value of element attribute of xml
March 31, 2015 06:39PM


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.