Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2010
    Posts
    10

    Question Unanswered: 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

  2. #2
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •