XML Functions Expressions containing user variables or variables local to stored programs must otherwise (except for notation) conform to the rules for XPath expressions containing variables as given in the XPath 1.0 specification. A user variable used to store an XPath expression is treated as an empty string. Because of this, it is not possible to store an XPath expression as a user variable. (Bug #32911) ExtractValue()  takes two string arguments, a fragment of XML markup  xml_frag  and an XPath expression  xpath_expr  (also known as a  locator ); it returns the text ( CDATA ) of the first text node which is a child of the element or elements matched by the XPath expression. Using this function is the equivalent of performing a match using the  xpath_expr  after appending /text() . In other words,  ExtractValue(’<a><b>Sakila</b></a>’, ’/a/b’)  and ExtractValue(’<a><b>Sakila</b></a>’, ’/a/b/text()’)  produce the same result. If multiple matches are found, the content of the first child text node of each matching element is returned (in the order matched) as a single, space-delimited string. If no matching text node is found for the expression (including the implicit  /text() )—for whatever reason, as long as  xpath_expr  is valid, and  xml_frag  consists of elements which are properly nested and closed—an empty string is returned. No distinction is made between a match on an empty element and no match at all. This is by design. If you need to determine whether no matching element was found in  xml_frag  or such an element was found but contained no child text nodes, you should test the result of an expression that uses the XPath count()  function. For example, both of these statements return an empty string, as shown here: • ExtractValue( xml_frag ,  xpath_expr ) mysql>  SELECT ExtractValue(’<a><b/></a>’, ’/a/b’); mysql>  SELECT ExtractValue(’<a><c/></a>’, ’/a/b’); +-------------------------------------+ | ExtractValue(’<a><b/></a>’, ’/a/b’) | +-------------------------------------+ | | +-------------------------------------+ +-------------------------------------+ | ExtractValue(’<a><c/></a>’, ’/a/b’) | +-------------------------------------+ | | +-------------------------------------+ +-------------------------------------+ | ExtractValue(’<a><b/></a>’, ’count(/a/b)’) | +-------------------------------------+ | 1 | +-------------------------------------+ mysql>  SELECT ExtractValue(’<a><b/></a>’, ’count(/a/b)’); mysql>  SELECT ExtractValue(’<a><c/></a>’, ’count(/a/b)’); +-------------------------------------+ | ExtractValue(’<a><c/></a>’, ’count(/a/b)’) | 2249 1 row in set (0.00 sec) 1 row in set (0.00 sec) However, you can determine whether there was actually a matching element using the following: 1 row in set (0.00 sec) Note