The meaning of [$@var-name] use in mysql ExtractValue() function -
@xml= '<a><b>x</b><b>y</b></a>'; set @i=1,@j=2; select extractvalue(@xml,'//b[$@i]');
i know meaning of $@
use in function.
$@
stands user variable. see mysql documentation: user variables (weak checking)
first of in posted code @xml= 'xy';
not valid xml.
to explain, //b[$@i]
xpath
query. in $@i
kind of variable interpolation. example documentation,
set @xml = '<a><b>x</b><b>y</b></a>'; set @i =1;
then doing select extractvalue(@xml, '//b[$@i]');
returns x
sine says
select first ([1] index) tag element b
. here, '//b[$@i]'
nothing saying '//b[1]'
Comments
Post a Comment