MySQL Forums
Forum List  »  Connector/Node.js

Extract numeric values from XML for use in query
Posted by: Christoph Schmitz
Date: June 29, 2007 01:28PM

Hi all,

I need to extract ID values from an XML string and use those NUMERIC values in a query. I need something like
SELECT *
FROM myTable
WHERE ID IN (List_of_values_from_XML)

I have been playing around with ExtractValue(), but, this function returns a string, and even if I replace the spaces with commas, it still is a string and not a comma separated list.
This here

SELECT *
FROM myTable
WHERE ID IN (replace(ExtractValue(myXML, '/root/elem@ID'), ' ', ','));

will obviously return only the first matching record of myTable.

What I would like even better than a comma separated list, would be some kind of recordset or virtual table that I could join to myTable. (In MSSQL you can use OPENXML() like this.)

Are there any ways to do one of these in MySQL?

Thank you in advance,

Chris

Options: ReplyQuote


Subject
Written By
Posted
Extract numeric values from XML for use in query
June 29, 2007 01:28PM


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.