If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > sql/xml help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-23-10, 15:04
db2_GoCubs db2_GoCubs is offline
Registered User
 
Join Date: Apr 2010
Posts: 3
sql/xml help

Hello, I am new to to DB2 and am stuck on a simple query. I have a table that contains some columns, one of which is an XML datatype.

I am using DB2-express c v9.7

When doing the below simple xquery through the control center

xquery
transform
copy $mycust := db2-fn:sqlquery('select XmlFile from table')
modify
do replace $mycust//DataNode/text()
with "newText"
return $mycust

it does in fact return properly. But when I try to incorporate it into a sql update statement such as

update table
SET XmlFile = xquery (
transform
copy $mycust := $c
modify do replace $mycust//DataNode/text()
with "newText"
return $mycust
passing XmlFile as "c"
)

I get an error message stating:

SQL0104N An unexpected token "copy $mycust := $c modify do replace $myc" was found following "= xquery ( transform". Expected tokens may include: "<space>".

I have gone back and forth, verifying syntax, typos, and still have not been able to locate the problem. Can someone help?

Thanks
Reply With Quote
  #2 (permalink)  
Old 04-23-10, 17:25
db2_GoCubs db2_GoCubs is offline
Registered User
 
Join Date: Apr 2010
Posts: 3
Figured it out apparently, I wasn't looking at the samples carefully enough... it should have read xmlquery(.... instead of xquery(...
Reply With Quote
Reply

Tags
sql/xml, xquery

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On