Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2013

    Unanswered: DB2 PureXML apend/concatenation question

    Can someone give me the syntax of a DB2 (LUW 9.7.8) XML update query to change the contents of a piece of XML within a XML document, and concatenate a string to an existing value (not knowing exactly what that value might be without looking it up).

    I understand a vanilla update statement would look something like this:

    update clients
    set contactinfo = xmlquery( '
    copy $new := $CONTACTINFO
    modify do replace value of $new/client/email with ""
    return $new' )
    where id = 3227;

    But I want to do something like what the following SQL would do, except do it inside the xquery (I want to concatenate a value to whatever comes back from the select, not knowing what the value is):

    update mytable.CONFIG set ENVIRONMENT=((select ENVIRONMENT from mytable.CONFIG where FILENAME='ServicePolicy.xml') || 'TEST') where FILENAME='ServicePolicy.xml'

    Any help would be appreciated

  2. #2
    Join Date
    Jun 2003
    Toronto, Canada
    Provided Answers: 1
    Not sure what you're trying to do, but consider the XML function fn:concat(). To get a better response you may want to show some sample "before" and "after" data, along with the table definition(s).
    "It does not work" is not a valid problem statement.

Tags for this Thread

Posting Permissions

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