So I'm working with DB2 from command line. Before you ask, yes, it is running with admin rights and I can connect to the database and db2 is running.

Here is my input in the cmd:

db2 xquery declare default element namespace "http://tpox-benchmark.com/security"; for $s in db2-fn:xmlcolumn("SECURITY.SDOC")/Security where $s/Symbol= "BCIIPRC" return $s

And this is the error that I get:

SQL16002N An XQuery expression has unexpected token "/" following "pace http:". Expected tokens may include: ":". Error QName=err:XPST0003. SQLSTATE=10505

有帮助吗?

解决方案

And your question is?

Your shell may be stripping away those double quotes. Try enclosing the entire xquery statement in single quotes:

db2 'xquery declare ... return $s'

其他提示

I replaced the " with ' and it works now. Thanks @mustaccio for the suggestion.

db2 xquery declare default element namespace "http://tpox-benchmark.com/security"; for $s in db2-fn:xmlcolumn("SECURITY.SDOC")/Security where $s/Symbol= "BCIIPRC" return $s
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top