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 > insert node in xml

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-15-11, 08:48
anost anost is offline
Registered User
 
Join Date: Sep 2010
Posts: 10
Question insert node in xml

Hi all,

I try to add a node into an existing xml row. I followed the guidelines of the "
Update xml in DB2 9.5" doc. The trouble I have is due to namespaces in my xml, unfortunately not covered in the doc.

I try:
Code:
update schema.table
set DATA = xmlquery('copy $new := $DATA
modify do insert <abc:results input="textarea" label="Soem more results"></abc:results>
as last into $new/abc:publication/abc:item
return $new')
Here the error SQL16005N came up.
Now I tried to include a namespace declaration into the query without success:
Code:
update schema.table
set DATA = xmlquery('declare namespace abc="http://www.abc-dummy.de";
copy $new := $DATA
modify do insert <abc:results input="textarea" label="Soem more results"></abc:results>
as last into $new/abc:publication/abc:item
return $new')
Could somebody provide me with the info how to add the namespace in the query?

Best,
Andreas
Reply With Quote
  #2 (permalink)  
Old 03-16-11, 11:14
anost anost is offline
Registered User
 
Join Date: Sep 2010
Posts: 10
solved

I found the solution, just if somebody else wants to know:

Code:
update schema.table
set DATA = xmlquery('declare namespace abc="http://www.abc-dummy.de";
copy $new := $DATA
modify do insert <abc:results xmlns="http://www.abc-dummy.de" input="textarea" label="Some more results"></abc:results>
as last into $new/abc:publication/abc:item
return $new')
I had also weird problems with my written text inside control center. I had to delete all text and to rewrite. Afterward it successes.

Cheers
anost
Reply With Quote
Reply

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