11-14-13, 13:23 #1Registered User
- 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:
set contactinfo = xmlquery( '
copy $new := $CONTACTINFO
modify do replace value of $new/client/email with "firstname.lastname@example.org"
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
11-14-13, 13:39 #2:-)
Provided Answers: 1
- Join Date
- Jun 2003
- Toronto, Canada
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.