I have been reading the PureXML cookbook avidly.
I am having trouble with several of the examples in Chapter 12 on updating XML using XMLQUERY. Many of the examples (Figure 12.8, 12.9, 12.10, etc.) do not show a PASSING .. AS .. clause in the XMLQUERY usage. Here is Figure 12.8
set info = XMLQUERY (' transform
copy $mycust := $INFO
modiffy do replace
value of $mycust/customerinfo/addr/street
with "43 WestCreek"
where cid = 1002
Is this an error in the book? Why is it not necessary to declare $INFO by means of PASSING INFO AS "INFO" clause in the XMLQUERY?
When I tried an anology in my own database it woudn't work until I thew in the PASSING.. AS ... clause
Pinned topic PureXML Cookbook XML UPDATE examples
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-03-01T20:45:48Z at 2012-03-01T20:45:48Z by MatthiasNicola
MatthiasNicola 120000E28R321 Posts
Re: PureXML Cookbook XML UPDATE examples2012-03-01T20:45:48ZThis is the accepted answer. This is the accepted answer.Hello,
the answer to your question is in section 7.2.1 "Referencing XML Columns in SQL/XML functions" on page 162 of the DB2 pureXML Cookbook.
In short, DB2 for Linux, UNIX, and Windows version 9.5 or higher allows you to reference columns directly as XQuery variables. Note that the variable name must be upper case, i.e. $INFO instead of $info.
This is just a shortcut notation to simplify the syntax a little bit.
You say that you tried an analogy in your own database but it didn't work. Which database were you using?