MySQL Forums
Forum List  »  Connector/Node.js

Re: sorting on xml property
Posted by: stgma stgma
Date: November 19, 2005 01:32AM

thanks, I've done it:

CREATE FUNCTION `extract`(xml varchar(512), tag varchar(64)) RETURNS varchar(512)
BEGIN

DECLARE startTag varchar(66);
DECLARE endTag varchar(67);
DECLARE start int;
DECLARE end int;
SET startTag = CONCAT('<', tag, '>');
SET endTag = CONCAT('</', tag, '>');
SET start = LOCATE(startTag, xml) + LENGTH(startTag);
SET end = LOCATE(endTag, xml) - start;
return SUBSTRING(xml, start, end);

END $$


I am passing the field 'xml' in the function. Is this a correct way of doing this? Is there a way for the function to know on which row it is operating?

thanks

Options: ReplyQuote


Subject
Written By
Posted
November 18, 2005 12:22PM
Re: sorting on xml property
November 19, 2005 01:32AM


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.