Topic
  • 5 replies
  • Latest Post - ‏2013-03-25T12:59:50Z by amcintyre
amcintyre
amcintyre
21 Posts

Pinned topic passing parameter marker to XQuery

‏2013-03-24T21:08:15Z |
In XMLEXISTS I can hard code this compare of a "sequence" and it works, ie; it finds matches on both symbols:
......

however, when I do this to use a parameter marker:
...symbol = $syms' passing cast(? as clob) as "syms")

it works when I pass one symbol but when I pass more than one (could be up to thousands), none will match. I've tried every combination of using parens, double quotes and single quotes I can think of but nada...

I want to be able to pass one or more symbols and have the match work regardless.

Thanks!!
Updated on 2013-03-25T12:59:50Z at 2013-03-25T12:59:50Z by amcintyre
  • amcintyre
    amcintyre
    21 Posts

    Re: passing parameter marker to XQuery

    ‏2013-03-24T21:11:11Z  
    reposting using gist...

    hard coded SQL works:
    https://gist.github.com/anonymous/5233541

    but when using parameter marker this only works when passing one symbol:
    https://gist.github.com/anonymous/5233550
  • amcintyre
    amcintyre
    21 Posts

    Re: passing parameter marker to XQuery

    ‏2013-03-24T21:17:17Z  
    • amcintyre
    • ‏2013-03-24T21:11:11Z
    reposting using gist...

    hard coded SQL works:
    https://gist.github.com/anonymous/5233541

    but when using parameter marker this only works when passing one symbol:
    https://gist.github.com/anonymous/5233550
    one more gist with more complete code:
    https://gist.github.com/anonymous/5233576
  • Henrik_Loeser
    Henrik_Loeser
    37 Posts

    Re: passing parameter marker to XQuery

    ‏2013-03-25T07:40:28Z  
    • amcintyre
    • ‏2013-03-24T21:17:17Z
    one more gist with more complete code:
    https://gist.github.com/anonymous/5233576
    Hi,

    in the hardcoded XMLEXISTS you operate with a sequence of values. When you pass in the string, it is treated as a single string. You could try to wrap the fn:tokenize() function around the passed in string and then compare.

    http://publib.boulder.ibm.com/infocenter/db2luw/v10r1/topic/com.ibm.db2.luw.xml.doc/doc/xqrfntkz.html

    Please post here whether that worked or not.

    --
    Henrik Loeser
    Read more about DB2 in my blog at http://blog.4loeser.net
  • Henrik_Loeser
    Henrik_Loeser
    37 Posts

    Re: passing parameter marker to XQuery

    ‏2013-03-25T12:43:05Z  
    Hi,

    in the hardcoded XMLEXISTS you operate with a sequence of values. When you pass in the string, it is treated as a single string. You could try to wrap the fn:tokenize() function around the passed in string and then compare.

    http://publib.boulder.ibm.com/infocenter/db2luw/v10r1/topic/com.ibm.db2.luw.xml.doc/doc/xqrfntkz.html

    Please post here whether that worked or not.

    --
    Henrik Loeser
    Read more about DB2 in my blog at http://blog.4loeser.net
    I wrote up some background information and the solution using tokenize() here:

    http://blog.4loeser.net/2013/03/passing-string-sequences-to-sqlxml.html

    --
    Henrik Loeser
    Read more about DB2 in my blog at http://blog.4loeser.net
  • amcintyre
    amcintyre
    21 Posts

    Re: passing parameter marker to XQuery

    ‏2013-03-25T12:59:50Z  
    I wrote up some background information and the solution using tokenize() here:

    http://blog.4loeser.net/2013/03/passing-string-sequences-to-sqlxml.html

    --
    Henrik Loeser
    Read more about DB2 in my blog at http://blog.4loeser.net
    Yes!! fn:tokenize worked!! I had looked at it a few times and thought, nah, that's for breaking a string into tokens.

    Which I suppose is what a "sequence" is...

    anyway, it worked great and thanks!!