vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I'm trying to execute a xquery statement and I get always errors. It seems that only the prolog section is giving me errors. If I want to declare a namespace the xquery processor is coming up with an "unexpected token" error. The same error appears if I just set the version. The xquery statement itself is working without prolog, but I get no results because of the missing namespace. db2 => xquery declare default element namespace "http://posample.org"; SQL16002N An XQuery expression has an unexpected token "" following "http://posample.org"". Expected tokens may include: "<MainModule>". Error QName=err:XPST0003. SQLSTATE=10505 |
| |||
| Hi, A question almost identical to this was recently answered on the developerworks Viper Forum. http://www-128.ibm.com/developerwork...=118807&cat=19 Basically, a prolog itself is not enough, you need to follow it with some xquery. The simplest query I used was the expression 3. So I tried: db2 -td% xquery declare default element namespace "http://posample.org"; 3% and this worked. Note that since the ; is used to separate the prolog from the xquery body, I changed the terminator to %. I hope this helps, post if you still have trouble. TomE tammo.mueller@gmail.com wrote: > Hi, > > > I'm trying to execute a xquery statement and I get always errors. > It seems that only the prolog section is giving me errors. > If I want to declare a namespace the xquery processor is coming up with > an "unexpected token" error. > The same error appears if I just set the version. > The xquery statement itself is working without prolog, but I get no > results because of the missing namespace. > > > db2 => xquery declare default element namespace "http://posample.org"; > > SQL16002N An XQuery expression has an unexpected token "" following > "http://posample.org"". Expected tokens may include: "<MainModule>". > Error > QName=err:XPST0003. SQLSTATE=10505 |
| ||||
| I should have been more clear: I wrote: > Basically, a prolog itself is not enough, you need to follow it with > some xquery. I should have said: you need to follow it with your desired xquery. Combine the xquery you want to execute and the prolog, and alter the terminator to have DB2 eat them in one gulp. The prolog will apply only to the xquery that follows it in the same DB2 statement. TomE tome wrote: > Hi, > > A question almost identical to this was recently answered on the > developerworks Viper Forum. > > http://www-128.ibm.com/developerwork...=118807&cat=19 > > Basically, a prolog itself is not enough, you need to follow it with > some xquery. The simplest query I used was the expression 3. So I > tried: > > db2 -td% > xquery declare default element namespace "http://posample.org"; 3% > and this worked. > > Note that since the ; is used to separate the prolog from the xquery > body, I changed the terminator to %. > > I hope this helps, post if you still have trouble. > > TomE > > tammo.mueller@gmail.com wrote: > > Hi, > > > > > > I'm trying to execute a xquery statement and I get always errors. > > It seems that only the prolog section is giving me errors. > > If I want to declare a namespace the xquery processor is coming up with > > an "unexpected token" error. > > The same error appears if I just set the version. > > The xquery statement itself is working without prolog, but I get no > > results because of the missing namespace. > > > > > > db2 => xquery declare default element namespace "http://posample.org"; > > > > SQL16002N An XQuery expression has an unexpected token "" following > > "http://posample.org"". Expected tokens may include: "<MainModule>". > > Error > > QName=err:XPST0003. SQLSTATE=10505 |