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

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -