XML Functions mysql>  SELECT @j, ExtractValue(@xml, ’//b[$@j]’); +------+--------------------------------+ | @j | ExtractValue(@xml, ’//b[$@j]’) | +------+--------------------------------+ | 2 | Y | +------+--------------------------------+ 1 row in set (0.00 sec) mysql>  SELECT @k, ExtractValue(@xml, ’//b[$@k]’); +------+--------------------------------+ | @k | ExtractValue(@xml, ’//b[$@k]’) | +------+--------------------------------+ | NULL | | +------+--------------------------------+ 1 row in set (0.00 sec) • Variables in stored programs (strong checking).   Variables using the syntax  $ variable_name can be declared and used with these functions when they are called inside stored programs. Such variables are local to the stored program in which they are defined, and are strongly checked for type and value. Example: mysql>  DELIMITER | mysql>  CREATE PROCEDURE myproc () ->  BEGIN -> DECLARE i INT DEFAULT 1; -> DECLARE xml VARCHAR(25) DEFAULT ’<a>X</a><a>Y</a><a>Z</a>’; -> -> WHILE i < 4 DO -> SELECT xml, i, ExtractValue(xml, ’//a[$i]’); -> SET i = i+1; -> END WHILE; ->  END | Query OK, 0 rows affected (0.01 sec) mysql>  DELIMITER ; mysql>  CALL myproc(); +--------------------------+---+------------------------------+ | xml | i | ExtractValue(xml, ’//a[$i]’) | +--------------------------+---+------------------------------+ | <a>X</a><a>Y</a><a>Z</a> | 1 | X | +--------------------------+---+------------------------------+ 1 row in set (0.00 sec) +--------------------------+---+------------------------------+ | xml | i | ExtractValue(xml, ’//a[$i]’) | +--------------------------+---+------------------------------+ | <a>X</a><a>Y</a><a>Z</a> | 2 | Y | +--------------------------+---+------------------------------+ 1 row in set (0.01 sec) +--------------------------+---+------------------------------+ | xml | i | ExtractValue(xml, ’//a[$i]’) | +--------------------------+---+------------------------------+ | <a>X</a><a>Y</a><a>Z</a> | 3 | Z | +--------------------------+---+------------------------------+ 1 row in set (0.01 sec) Parameters.   Variables used in XPath expressions inside stored routines that are passed in as parameters are also subject to strong checking. 2248