Databases Reference
In-Depth Information
Example 1-1 Generated source code
values(XMLQUERY('
declare boundary-space strip;
declare namespace def0="http://posample.org";
for $name0 in
db2-fn:xmlcolumn("CUSTOMER.INFO")/def0:customerinfo/def0:name
where matches ( $name0/../def0:addr/def0:city,"Toronto","i" )
return
(
$name0,
$name0/../def0:addr/def0:city
)
' RETURNING SEQUENCE))
You can execute the same query from the script file as shown in Example 1-2.
Example 1-2 Query script
Values (XMLQUERY('
declare boundary-space strip;
declare namespace def0="http://posample.org";
for $name0 in
db2-fn:xmlcolumn("CUSTOMER.INFO")/def0:customerinfo/def0:name where
matches ( $name0/../def0:addr/def0:city,"Toronto","i" )
return
(
$name0,
$name0/../def0:addr/def0:city
)
'
RETURNING SEQUENCE))
@
Example 1-2 is the syntax for the XMLQuery. We can modify the source for
XQuery as shown in Example 1-3.
Example 1-3 Modified source
xquery
declare default element namespace "http://posample.org";
for $name0 in
db2-fn:xmlcolumn("CUSTOMER.INFO")/customerinfo/name where matches (
$name0/../addr/city,"Toronto","i" )
return
(
Search WWH ::




Custom Search