Topic
2 replies Latest Post - ‏2011-12-15T05:20:38Z by SystemAdmin
SystemAdmin
SystemAdmin
230 Posts
ACCEPTED ANSWER

Pinned topic Xquery: problem when using FLWR rule

‏2011-12-14T13:29:57Z |
Hello Folks,

My very first query in IBM portal :)

Am trying to execute xquery from putty.
Tried xquery using PATH which worked but the same using FLWR not working.


db2 "xquery
db2-fn:xmlcolumn('CLIENTS.CONTACTINFO')/Client/fax" --> worked



db2 "xquery
for $y in db2-fn:xmlcolumn('CLIENTS.CONTACTINFO')/Client/fax
return $y" --> not working, below is the error

An XQuery expression has an unexpected token "in" following "for ".
Expected tokens may include: "is". Error QName=err:XPST0003. SQLSTATE=10505



Please help me, learning xqueries and got stuck. :(

Thanks,
Aparna
Updated on 2011-12-15T05:20:38Z at 2011-12-15T05:20:38Z by SystemAdmin
  • Henrik_Loeser
    Henrik_Loeser
    37 Posts
    ACCEPTED ANSWER

    Re: Xquery: problem when using FLWR rule

    ‏2011-12-14T13:45:34Z  in response to SystemAdmin
    Did you try to escape the $ sign, e.g.:
    db2 "xquery
    for \$y in db2-fn:xmlcolumn('CLIENTS.CONTACTINFO')/Client/fax
    return \$y"

    Depending on the shell it tries to replace variables.
    --
    Henrik Loeser
    Read more about DB2 in my blog at http://blog.4loeser.net