purexml指南


IBM DB2 10.1 for Linux, UNIX, and Windows pureXML 8O |B1d 2013 j 1 B S151-1775-01  IBM DB2 10.1 for Linux, UNIX, and Windows pureXML 8O |B1d 2013 j 1 B S151-1775-01  "b 9CKE"0d'VDz70,kHDAZ 461 3D=< E, :yw;BD#fE"# ^)fyw KD5|, IBM DyP(E"#|ZmI-iPa),R\f((D#$#>vfoP|,DE";|(TNNz7D #$,Ra)DNNod<;h*gKbM# zIZ_r(}1XD IBM zm&): IBM vfo# v *Z_):vfo,k*A IBM vfoPD,x7*:http://www.ibm.com/shop/publications/order v *iR1XD IBM zm&,k*A IBM +r*5K?<,x7*:http://www.ibm.com/planetwide/ *S@zrSCsD DB2 P!Mz[?): DB2 vfo,kBg 1-800-IBM-4YOU(426-4968)# z"ME"x IBM s,4Zh IBM G@<(^,IBM IT4|O*J1DNN==9CrV"zya)DNNE"x ^kTzP#NNpN# © Copyright IBM Corporation 2006, 2013. ?< XZ>i ..............vii Z 1 B pureXML Ev -- DB2 w* XML }]b ...............1 XML }]`M..............3 XML dkMdvEv ...........3 HO XML #MMX5#M .........7 XQuery M XPath }]#M .........8 rPMn...............8 -S5 ...............9 ZccNa9 .............10 ZctT ..............11 ZcV` ..............12 ZcDD53r ............14 Zcj6 ..............14 ZcD`M5MV{.5 .........15 'V XML D$_ ............15 pureXML D*O'V ...........17 pureXML D4FMB~"<'V .......17 XZ XML 'VDDB...........17 Z 2 B pureXML LL ........19 NL 1:4(ITf" XML }]D DB2 }]bM m .................19 NL 2:4(yZ XML }]Dw} ......20 NL 3:+ XML D5ek= XML `MPP ...21 NL 4:|Bf"Z XML PPD XML D5 ...22 NL 5:>} XML }] ..........23 NL 6:i/ XML }] ..........24 NL 7:kT XML #=i$ XML D5 ....27 NL 8:9C XSLT y=mxPd; ......29 Z 3 B XML f"w .........33 XML f"Ts .............33 XML y>mPf"w ...........33 XML D5Df"*s ...........34 i5 XML D5D}]`M .........35 Z 4 B ek XML }] .......37 4(_P XML PDm...........37 + XML PmSAVPm ..........38 ek= XML PP ............38 XML bv ...............39 XML }]j{T ............43 XML PDlij8D XML bvMi$ms ......51 v?Dms{"'VD ErrorLog XML #=(e 53 ZG Unicode }]bP9C XML.......56 Z 5 B i/ XML }] .......61 XQuery ri ..............61 9C XQuery /}lw DB2 }] .......62 9C SQL i/ XML }]ri........63 XQuery k SQL DHO ..........64 HOCZi/ XML }]D=(........64 8( XML {FUd ...........65 >}:|D*XD{FUd0: ........67 XMLQUERY /}Ev...........69 XMLQUERY 5XDGUrP .......69 XMLQUERY 5XDUrP ........70 + XMLQUERY a{D?F`M*;*G XML `M ................71 }]`M.dD?F*; .........72 XMLQUERY .............80 XMLTABLE /}Ev ...........82 >}:ek XMLTABLE P5XD5 .....83 >}:9C XMLTABLE T3nD?v5}5X; P ................85 >}:9C XMLTABLE &m XML D5P`v wy|,D*X ............86 >}:9C XMLTABLE &mVc}] ....88 XMLTABLE .............89 i/ XML }]1D XMLEXISTS =J .....93 XMLEXISTS =JC>..........94 XMLEXISTS =J ...........95 Z SQL odk XQuery mo=.d+]N} ...97 +]A XMLEXISTS M XMLQUERY D#?MN }jG ...............97 9C XMLEXISTS"XMLQUERY r XMLTABLE +]Dr%P{ ............98 +N}S XQuery +]A SQL.......99 9C XQuery lw}] ..........100 CZ%dw}ki/DQw .........108 + XML PPD}]lwAOgf>D DB2 M'z 109 CZ9l XML 5D SQL/XML "} ..........111 SQL/XML "}:+ XSLT Cwq=/}f ......119 >}:9C XSLT 4xP}];; .....121 © Copyright IBM Corp. 2006, 2013 iii >}:9C XSLT 4}%{FUd .....122 >}:9C XSLT DD5&\ .......125 d; XML D5DX*"bBn ......126 f"Mlws XML D5PDnp ......127 Z 6 B * XML }]("w} ....129 w} XML #=mo= ..........130 9C;xVs!4D XML w}D>} ....133 9C8(K fn:exists Dw}D>} .....135 +w}k8(K fn:starts-with Di/dO9CD >} ...............137 OBD=hM/}mo==h .......139 XML {FUdyw ...........140 kw} XML #=mo=X*D}]`M ....141 yZ XML }]Dw}D}]`M*; .....142 ^' XML 5 ............143 D5b\r CREATE INDEX od'\ ....145 XZ*;*w} XML }]`MD\am ...146 XML #=Mw}|zI ..........146 UNIQUE X|Voe ...........147 k* XML }]("w}`X*D}]bTs ...148 yZ XML }]D_-w}Momw} ....148 k XML PX*Dd{}]bTs .....149 XB4(yZ XML }]Dw} ......150 CREATE INDEX ............151 kTyZ XML }]Dw}Dy>i/ .....169 TyZ XML }]Dw}D^F .......171 #{ XML ("w}Jb .........173 oO INSERT r UPDATE od"vD SQL20305N {" ...........174 oO CREATE INDEX odTndDm"vD SQL20306N {" ...........176 Z 7 B |B XML }] .......179 Zd;mo=P9C|BYw ........180 9Cd{mPDE"|B XML D5 ......183 SmP>} XML }] ..........184 Z 8 B XML #=f"b.......185 XSR Ts ..............185 XSR Ts"a .............185 (}f"}L"a XSR Ts .......186 (}|nP&mw"a XSR Ts......187 T XML #="aM>}D Java 'V ....188 Dd"aD XSR Ts ..........190 ]x XML #= ...........190 ]x XML #=Df]T*s .......190 =8:]x XML #= .........198 i! XML #=E"D>} .........199 P>Qr XSR "aD XML #= .....199 lwQr XSR "aD XML #=DyPiI? V ................200 lw XML D5D XML #= .......200 Z 9 B XML }]F/ .......201 PXF/ XML }]DX*"bBn ......202 i/M XPath }]#M ..........203 }:}C6k= SQL &CLrPD XML w d? ...............222 4P6k= SQL &CLrPD XQuery mo= 223 XZ9C XML M XQuery *"6k= SQL & CLrD(i ............225 j6 SQLDA PD XML 5 .......225 Java ................226 Java &CLrPD~xF XML q= ....226 JDBC ...............227 SQLJ ...............235 PHP................240 IBM }]~qwD PHP &CLr*" ....240 9C PHP &CLrlw XML }] .....241 PHP BXM`XJ4 ..........241 Perl.................241 pureXML M Perl ...........241 Perl PD}]b,S ..........244 Perl ^F ..............245 }L ................245 SQL }L..............245 SQL /}..............247 b?}L ..............250 }LDT\ .............261 y>&CLr .............266 pureXML y> ............266 pureXML - \my> .........267 pureXML - &CLr*"y> ......269 Z 11 B XML T\ .........275 pureXML &\?~M}]i/=8 ......275 ZVx}]b73P9C XQuery d;D>} ...276 +QywY1mk XML }]dO9C .....278 +E/} .....281 CZ pureXML }]f"T\D DMS mUdDW! n .................286 Z 12 B XML }]`k .......287 Z?`kD XML }] ..........287 iv pureXML 8O f"r+] XML }]1D`k"bBn ....288 + XML }]dk}]b1D`k"bBn . . 288 S}]bPlw XML }]1D`k"bBn 288 Z}LN}P+] XML }]1D`k"bBn 289 JDBC"SQLJ M .NET &CLrPD XML }] `k"bBn ............289 XML `kMrP/TZ}]*;D0l.....290 `kiv:+Z?`kD XML }]dk=}] bP ...............290 `kiv:+b?`kD XML }]dk=}] bP ...............291 `kiv:(}~=DrP/Yw4lw XML }] ...............293 `kiv:9CT=D XMLSERIALIZE 4lw XML }] .............295 3dZ?`kD XML }]M CCSID .....297 +`k{3dAQf"D XML }]DP' CCSID...............297 + CCSID 3dArP/ XML dv}]D`k { ................309 Z 13 B x"MD XML #=Vb ...315 x"MD XML #=VbDEc .......315 9Cx"MD XML #=4Vb XML D5 ...315 "a XML #="TdtCVb ......316 `v XML D5Vb>} ........317 x"MD XML #=VbM]i XML D5 . . 318 {Cx"MD XML #=Vb ........322 CZx"MD#=VbD xdbDecompXML }L . . 323 DECOMPOSE XML DOCUMENT.......326 x"MD#=VbD XDB_DECOMP_XML_FROM_QUERY f"}L . . 327 XML Vb"M .............330 XML Vb"M - f6MwCr ......330 XML Vb"M - \a .........331 db2-xdb:defaultSQLSchema Vb"M .....332 db2-xdb:rowSet Vb"M.........333 db2-xdb:table Vb"M .........337 db2-xdb:column Vb"M ........340 db2-xdb:locationPath Vb"M .......342 db2-xdb:expression Vb"M........345 db2-xdb:condition Vb"M ........348 db2-xdb:contentHandling Vb"M ......351 db2-xdb:normalization Vb"M.......355 db2-xdb:order Vb"M .........357 db2-xdb:truncate Vb"M ........359 db2-xdb:rowSetMapping Vb"M ......361 db2-xdb:rowSetOperationOrder Vb"M ....364 x"MD XML #=VbDX|V .....365 x"MD XML #=VbPgNNIVba{ ...366 T XML Vba{xPi$DwC .....367 x"MD XML #=VbPT CDATA ?VD& m ................367 x"MD XML #=VbPDU5MUV{. 368 CZx"MD XML #=VbDKTm .....369 *xPx"MD XML #=VbxTIzD4S `MmSD"M............369 Vb&\D XML #=9l(i ......372 x"MD XML #=VbPD3d>} .....373 x"MD XML #=VbPDP/ .....373 Vb"M>}:3dA XML P ......376 Vb"M>}:;v53dA%vmazz%vP 377 Vb"M>}:;v53dA%vmazz`vP 378 Vb"M>}:;v53dA`vm .....380 Vb"M>}:+3dA%vmD`v5xPVi 381 Vb"M>}:+;,OBDPD`v53dA% vm ...............383 x"MD#=VbD XML #== SQL `Mf]T 385 x"MD XML #=VbD^F .......388 x"MD XML #=VbDJOoO"bBn ...390 XML Vb"MD#=...........391 Z 14 B T pureXML D^F ....393 T pureXML &\D^F..........393 =< A. `k3d ..........397 +`k{3dAQf"D XML }]DP' CCSID 397 + CCSID 3dArP/ XML dv}]D`k{ 408 =< B. SQL/XML " SQL 4,oz ......455 CJ;,f>D DB2 E"PD .......456 |B20ZFczrZ?x~qwOD DB2 E"P D .................456 V/|B20ZFczrZ?x~qwOD DB2 E "PD................457 DB2 LL...............459 DB2 JOoOE"............459 E"PDunMu~ ...........460 =< E. yw ............461 w} ...............465 vi pureXML 8O XZ>i pureXML® 8OhvgNZ DB2® }]bP9C XML }]#|+f_zPX XML } ]`MM XML f"wD*6,gN9C SQL M XQuery oT49C XML }], T0gN*T\("w} XML }]#d{wb|( pureXML &CLr"9,}]F /MQ XML }]Vb*`Xq=# © Copyright IBM Corp. 2006, 2013 vii viii pureXML 8O Z 1 B pureXML Ev -- DB2 w* XML }]b pureXML &\?~Jmz+q=zVca9N=,x ;G+dw*D>f"r3d*d{}]#M# r* pureXML }]f"Qj+/I,yTI{CVP DB2 }]b~qw&\4CJ M\mf"D XML }]# + XML }]Td>zVca9N=4f"IT9 XML DQw"lwM|B'J| _#XQuery"SQL rOv~_DiOICZi/M|B XML }]#5X XML }] rIC XML Td?D SQL /}(F* SQL/XML /})9\y]S}]bPlwD 549lr"< XML }]# i/M|B I9CBP=(i/M|Bf"Z XML PPD XML D5: XQuery XQuery GCZbM"lwM^Di/ XML }]D(CoT#DB2 }]b~ qwJm1SwC XQuery rS SQL wC XQuery#r* XML }]f"Z DB2 mMS } XML D5#DB2 }]b~qw'VD;i SQL/XML /}"mo=Mf 6{C XML }]`M# ITS SQL i/PwC XQuery#ZbVivB,SQL i/IT+}]Ts( d?DN=+]A XQuery# &CLr*" m``LoT(} SQL Mb?}La)KT&CLr*"D'V: `LoT'V TBD pureXML &\D&CLr*"'V9C&CLr\;iO XML MX 5}]DCJMf"#BP`LoT'V XML }]`M: v C r C++(6k= SQL r CLI) v COBOL v Java™(JDBC r SQLJ) v C# M Visual Basic(IBM® }]~qw .NET a)Lr) v PHP © Copyright IBM Corp. 2006, 2013 1 v Perl SQL Mb?}L (}Z CREATE PROCEDURE N}Xw{P|, XML }]`MN},I+ XML }]+]A SQL }LMb?}L#VPD}L&\'V'F SQL od 5V}L_-w,|Gzzr{C XML 5T0d?PD XML }]5Y1f "w# \m pureXML &\a)CZ\m XML D5D URI @5X5Df"b"JmCZ}]b\ mD XML }]F/: XML #=f"b (XSR) XML #=f"b (XSR) GCZfEZ&m XML PPf"D XML 5}D5 1yhDyP XML $~Df"b#|f" XML D5P}CD XML #=" DTD Mb?5e# z XML }]`M#b)5CLr s&m LOB }];y4&m XML }]:b=V`MD}]z}]`M+q=zVcq=f"Zd {X5}]T_D}]bP# 9CZ?m>4&m XML 5,Z?m>;GV{.,"R;\1SkV{.5xPH O#(}9C XMLSERIALIZE /}r+ XML 5s(A`M* XML"V{.r~x FD&CLrd?,IT+ XML 5d;Im> XML D5DQrP/V{.5#, y,(}9C XMLPARSE /}r+&CLrV{."~xFr XML &CLr`Ms (A XML 5,IT+m> XML D5DV{.5d;* XML 5#Zf0 XML P D SQL }]|Dod(g INSERT)P,(}9CQekD XMLPARSE /}+m> XML D5DV{.r~xF5d;I XML 5#k&CLrV{.M~xF}]`M ;;1,IT~=bvrrP/ XML 5# Za9OT}]bPD XML 5Ds!;P^F#+G,k"b,k DB2 }]b~q w;;DQrP/ XML }]Ds!^F* 2GB# I9C SQL }]Ywodek"|BM>} XML D5#XML #=f"b (XSR) ' V(#Zekr|BZdkT XML #=i$ XML D5#DB2 }]b539a)K CZ9lMi/ XML 5T0r3dAm;}]#M# ITZ|,d{`MDP(b)P#fX5}])DmP(e XML P;IT*%vm (e`v XML P# dk Z 4 3D< 1 T>KICZ+ XML }]Ek}]b53PDwV=(# Z 1 B pureXML Ev 3 9CDdk=(!vZ*jIDNq: ekr|B I9C INSERT SQL od+q=KICZS}]b53Plw XML }]DwV=(# Z 1 B pureXML Ev 5 9CDdv=(!vZ*jIDNq: XQuery XQuery G;VICZZ XML D5ZxPi/DoT#|zcKi/a9d/ G#sD XML }]DX(hs,ki/a9I$bDX5}]G;,D# XQuery ITT:wCT:,2IT(} XQuery /} db2-fn:xmlcolumn M db2- fn:sqlquery wC SQL 4i/f"Z DB2 }]bPD XML#db2- fn:xmlcolumn +lw{v XML P,x db2-fn:sqlquery +lwyZ SQL +i /D XML 5# SQL 19C SQL +i/4i/ XML }]1,+ZP6pxPi/#rK,Ci /;\5X{v XML D5;vv9C SQL G;I\5X XML D5|,D ,ND#*Z XML D5ZxPi/,Xk9C XQuery#IT9C SQL/ XML /} XMLQUERY r XMLTABLE r_9C XMLEXISTS =J"(} wC SQL 4wC XQuery#XMLQUERY /}+ XQuery mo=Da{T XML DB2  XQuery &$ (/) Xquery SQL SQL XML &$ SQL Xquery SQL ( XML ) DB2 !" !"#$*+ < 2. CZdv XML }]D=( 6 pureXML 8O rPN=5X#XMLTABLE /}+ XQuery mo=Da{TmDN=5X# XMLEXISTS SQL =J7( XQuery mo=Gqa5XGUrP# 9I9CtI"D# HO XML #MMX5#M hF}]b1,Xk7(}]|JO XML #M9GX5#M# {C DB2 }]bD lOXc,4:Z,;}]bP'VX5}]M XML }]# d;>V[bMKb=v#M.dDw*xpT0JCZ?v#MDrX,+9P\ `rXIozz!qnOJD5V#+>V[w*;v XML D5TcNa9N=|,PX}]n.dDX5DE"#TZX5#M, IT(eD(;X5`MG8mMStmX5# XML }]\;Thv;xX5}];\ XML D5;v|,}],9|,PXCZ5w}]DEnDjG#%vD5I TP;,`MD}]#TZX5#M,}]DZ]IdP(e(e#PPDy P}]XkG`,`MD}] # XML }]_PL(Er;xX5}];P TZ XML D5,Y(8(D}]n3rGD5P}]D3r#(#;Pd{ =(48(D5ZD3r#TZX5}],}GT;Pr`P8( ORDER BY Sd,qr;\#$PD3r# 0l}]#M!qDrX f"D}]V`Iozz7(f"==#}g,g{}]lzGVcRThvD,G 4IT+|f"* XML }]#+G,d{rX2I\a0lzv(*9CD#M# h*nsinT1 X5mq-G#OqD#M#}g,+;vmf6/*m`mr+m`m4r f6/*;vmI\G#'Q#g{-#|D}]hF,G4+|m>* XML }]GOCD!q#}g,XML #=If1d]x# }]lwh*nCT\1 rP/MbM XML }]azz;)*z#g{T\HinT|X*,G4X 5}]I\GOCD!q# }]Tsw*X5}]&m1 g{T}]Dsx&m!vZ*f"ZX5}]bPD}],G49CVb+ ?V}]w*X5}]f"I\OOJ#+*zVv&m(OLAP)&CZ} Z 1 B pureXML Ev 7 ]VbPD}]MGby;v>}#Kb,g{h*+T XML D5Dd{& mw*;v{e,G4ZbVivB,OOJD=(G+?V}]w*X5} ]f""f"{v XML D5# }]i~ZcNa9b_Pbe1 }]>mI\PLPDVcq=,+Si~;h*8i~a)5#}g,I: )%I\|,?~E#nC+xP?~EDI:)%T XML D5DN=m># +G,?v?~EMQwbV`MD}],+9C XML #M4m>MQwM`T*]W;)# }]4STk]?.HO_1 Zm`ivB,Y?}]P|,K_Ha9/DE"#9CX5#Mm>C} ]+f04SDGM#=,ZC#=P?v,m,SAm`v,m,"RdP s`}m;PY?P#m>K}]D;VOC=(G9C_P XML PD%v m,"RTCm4(S<,?vS;v,# h*}Cj{T1 ;\+ XML P(e*}C#}]#Ma(e XQuery PDm o=DJm5,|(PdFcZd9CD5# + XML }]bv* XDM,"Z XQuery &m}].0kT#=4i$b)}]#Z zI}]#MZd,+bvdk XML D5,"+|*;* XDM D5}#ZbvD5 1,ITxPi$,2IT;xPi$# XDM G4U-S5MZcrP4xPhvD# rPMn XQuery M XPath }]#M(XDM)D5}*rP#rPG 0 vnr`vnDPr/ O#;vnMG;v-S5r;vZc# 8 pureXML 8O ;vrPIT|,Zc"-S5r_GZcM-S5DNbiO#}g,BfPmP D?vu? v (2, 3, 4) v (36, , "cat") v () }PmPDu?.b,f"Z DB2 }]bD XML PPD XML D5G;vrP# >}PC4m>rPDm>(,kC49l XQuery PDrPDo(G;BD: v rPPD?n.dC:EVt# v {vrPGC2(E(p4D# v ;TUD2(Em>;vUrP# v g{;vnZ|TmO=vV,G4`1Z;v;|,;nDrP# }g,rP (36) k-S5 36 ;Pxp# ;\TrPxP6W#1iO=vrP1,qCDa{1YDE"r4*E"# -S5 -S5GI XML #=(eDdP;VZC-S}]`MD5}#b)}]`M|( String"Integer"Decimal"Date Md{-S`M#b)`M<;hv*-S`M,-r G|G^(Y8VK# kZc;,DG,-S5;Pj6#-S5D?v5}(}g,{} 7)kC5Dd{ ?v5}}G;)zI-S5D=(: v (};vF*“-S/”D}LSZcPi!#?1h*-S5rP1,mo=Ma 9C-S/# v 8(*}VrV{.DV#XQuery a+DVbM*-S5#}g,BPDVMa; bM*-S5: – “this is a string”(`M* xs:string) –45(`M* xs:integer) – 1.44(`M* xs:decimal) v I9l/}FcqC#}g,TB9l/}+y]V{.“2005-01-01”49(`M* xs:date D5: xs:date("2005-01-01") v IZC/} fn:true() M fn:false() 5X#b)/}+5X<{5 true M false#b )5;\m>*DV# v I`Vmo=(}g,cumo=M_-mo=)5X# Z 1 B pureXML Ev 9 ZccNa9 iI;vr`vcNa9rwDZcrP,b)cNa9rwI;vyZcMISC yZc1SrdSCJDyPZciI# ?vZc;tZ;vcNa9,x?vcNa9;P;vyZc#DB2 'VTB 6 V Zc:D5"*X"tT"D>"&m8>E"M"M# TB XML D5 products.xml |(;vy*X products,Cy*XV|,;) prod- uct *X#?v product *X Fleece jacket 19.99 Nylon pants 9.99 Z 11 3D< 3 T> products.xml D}]#MDr/m>#CZc(T)# 10 pureXML 8O g>}Py>,;vZcI+d{Zcw*Sz,SxiI;vr`vZccNa 9#ZC>}P,product *XG products DSz#description *X4G product DSz#name M price *XZcG name *XDSz,xD>Zc 19.99 G price *XDSz# ZctT ?vZc<_P;)XT,b)XTC4hvCZcDXw#}g,ZcDXTI\ |(:ZcD{F"Sz"8z"tTT0C4hvCZcDd{E"#ZcV`7 (*X(Zca)KD)tT# ;vZcIT_PBfD;vr`vtT: node-name ZcD{F,m>* QName# 8z G10ZcD8zDZc# pid Fleece jacket Nylon pants19.99 9.99 products.xml pid E E D A A E E TT TT EEE E E < 3. products.xml D5D}]#M< Z 1 B pureXML Ev 11 type-name ZcD/,(KP1)`M(2F*`M"M)# Sz G10ZcDSzDZcrP# tT tZ10ZcD;itTZc# string-value ITSZcPi!DV{.5# typed-value ITSZcPi!DIcvrcvTO-S5iIDrP# {FUdwCr kZc`X*DwCrZ{FUd# content ZcDZ]# ZcV` DB2 'VTB 6 VZc:D5"*X"tT"D>"&m8>E"M"M# D5Zc D5Zc|, XML D5# D5ZcIT_P`vSz,2IT;PSz#SzITG*XZc"&m8nZ c""MZcMD>Zc# D5ZcDV{.5HZ+|DyPszD>ZcDZ]4D53rxP"CDa {#V{.5D`M* xs:string#D5ZcD`M5kV{.5`,,+`M5D`M * xdt:untypedAtomic# D5Zc_PBPZctT: v children(I\GUD) v string-value v typed-value ITZ XQuery mo=P9C-}FcqCD9l/}49lD5Zc#db2- fn:xmlcolumn /}9IT5X;5PD5Zc# *XZc *XZc|, XML *X# ;v*XIT_P;v8z,2IT;P8z;,1,|IT_P`vSz,2IT ;PSz#SzITG*XZc"&m8nZc""MZcMD>Zc#D5ZcM tTZcv;aG*XZcDSz#+G,ITO**XZcG|T:DtTD8 z#*XZcDtTXk_P(;D QName# *XZc_PBPZctT: v node-name v parent(I\GUD) v type-name 12 pureXML 8O v children(I\GUD) v attributes(I\GUD) v string-value v typed-value v in-scope-namespaces ITZ XQuery mo=P9C1S9l/}r_-}FcqCD9l/}49l*XZ c# *XZcD type-name tT8>|D`M5kV{.5.dDX5#}g,g{;v* XZc_P type-name tT xs:decimal MV{.5“47.5”,G4`M5MG!}5 47.5# g{*XZcD type-name tTG xdt:untyped,G4*XD`M5HZdV{.5," R`M* xdt:untypedAtomic# tTZc tTZcm> XML tT# tTZcIT_P;v8z,2IT;P8z#I+5PtTD*XZcO*G|D 8z,!\tTZc;G|D8*XDSz# tTZc_PBPZctT: v node-name v parent(I\GUD) v type-name v string-value v typed-value ITZ XQuery mo=P9C1S9l/}r_-}FcqCD9l/}49ltTZ c# tTZcD type-name tT8>|D`M5kV{.5.dDX5#}g,g{;vt TZc_P type-name tT xs:decimal MV{.5“47.5”,G4|D`M5MG!}5 47.5# D>Zc D>Zc|, XML V{Z]# D>ZcIT_P;v8z,2IT;P8z#w*D5Zcr*XZcDSzDD >Zcv;aw*`Z,zvV#19lD5Zcr*XZc1,NN`ZDD>Z c,zZc#g{qCDD>ZcGUD,G4a+|Oz# D>Zc_PBPZctT: v content(I\GUD) v parent(I\GUD) ITZ XQuery mo=P9C-}FcqCD9l/}49lD>Zc,2IT(}1 S*X9l/}DYw49lD>Zc# Z 1 B pureXML Ev 13 &m8nZc &m8nZcab0 XML &m8n# &m8nZcIT_P;v8z,2IT;P8z#&m8nDZ];\|,V{. ?>#&m8nD?jXkG;v NCName#C?jC4j6*+8>E""MxD&C Lr# &m8nZc_PBPZctT: v target v content v parent(I\GUD) ITZ XQuery mo=P9C1S9l/}r_-}FcqCD9l/}49l&m8 nZc# "MZc "MZc|, XML "M# "MZcIT_P;v8z,2IT;P8z#"MZcDZ];\|(V{.“--” (=v,V{),"Rns;vV{;\G,V{(-)# "MZc_PBPZctT: v content v parent(I\GUD) ITZ XQuery mo=P9C1S9l/}r_-}FcqCD9l/}49l"MZ c# ZcDD53r ;vcNa9PDyPZc<*qS3;3r(4,D53r)#4UC3r,?v Zc<+ZdSz0fvV#g{ZccNa9GCQrP/D XML m>D,G4D 53rkZcDvV3r`T&# cNa9PDZc4TB3rvV: v yZcGZ;vZc# v *XZcZ|GDSz0fvV# v tTZctzZk|G`X*D*XZcsfvV#tTZcD`T3rITGN bD,+GZ&mi/ZdK3r;aDd# v ,zD`T3rI|GZZccNa9PD3r47(# v ;vZcDSzMsz+ZCZcsfD,z0fvV# Zcj6 ?vZc ZcDZ]4D53rxP"CDa{# xdt:untypedAtomic }]`MD5},|G+|DyP szD>ZcDZ]4D53rxP"CDa{# XML D5P D*X xs:string }]`MD5},|G+|DyPD>Zc szDZ]4D53rxP"CDa{# xdt:untypedAtomic }]`MD5},|G+|DyP D>ZcszDZ]4D53rxP"CDa{# XML D5P DtT xs:string }]`MD5},|m>-< XML D5P DtT5# xdt:untypedAtomic }]`MD5},|m>-< XML D5PDtT5# D> w* xs:string }]`MD5}DZ]# w* xdt:untypedAtomic }]`MD5}DZ]# "M w* xs:string }]`MD5}DZ]# w* xs:string }]`MD5}DZ]# &m8n w* xs:string }]`MD5}DZ]# w* xs:string }]`MD5}DZ]# 'V XML D$_ IBM MZ}=$_'V9C pureXML &\?~#BP$_Gf DB2 }]b~qwa )Dr_GI%@S IBM BXD: IBM Data Studio T XML D'V|(BPZ]: v f"}L:IT4(MKP|, XML }]`Mw*dkMdvN}Df" }L# v }]dv:ITwMrD>N=i4|,Z XML PPDD5# v SQL `-w: I4(,19CX5}]M XML }]D SQL odM XQuery mo=# v XML #=:IT\m XML #=f"b (XSR) PD#=D5,|("aM >}#=T0`-#=D5# v XML D5i$:ITkTZ XSR P"aD#=i$ XML D5# v C'(eD SQL /}: I4("KP9C XML N}DC'(eD SQL /}# |nP&mw 8v DB2 |n'V>zf" XML }]#ITS DB2 |nP&mw(CLP) 9CX5}]T_D XML }]#ITS CLP 4PDNqD>}|(: v (}T XQuery odSO XQUERY X|V0:4"v XQuery od# v "XML PPDD5r>XD~PD XML #=T}y>: EXPLAIN PLAN SELECTION FOR XQUERY ’for $c in db2-fn:xmlcolumn("XISCANTABLE.XMLCOL" )/a[@x="1"]/b[@y="2"] return $c’ DB2 +6q EXPLAIN mPDf!=8E"#yP XML PDZ{rPs!< f"Z EXPLAIN_STREAM mD SEQUENCE_SIZES PP#zI\9a"b = EXPLAIN_PREDICATE mPfZ3)}],|GG;)z^(6pD=J# b)=JI DB2 }]b~qwZ EXPLAIN YwZdTw}(hP9CD XPath mo=xPs51zI#z;h*@@K=JE"#b)=J;GE/w =8D;?V,rKZ PREDICATE_ID M FILTER_FACTOR PPD5* -1# r_,(}9C IBM Data Studio 4i4b)f!=8DZ DB2 }]b~qwQ+ AND =J&CZ`vw}(hDa{# XISCAN 8> DB2 }]b~qwQ9CyZ XML }]Dw}4CJ}]# XSCAN 8> DB2 }]b~qwQT XPath mo=s5,"RQS XML D5P i! XML D5,N# XANDOR 8> DB2 }]b~qwQ+ AND M OR =J&CZ`vw}(hDa {# XTQ 8> DB2 }]b~qw9CKXbmSP(TQ)++V XML rPPD 16 pureXML 8O ?n"M=d-<}]bVx,y]CnD@@S XML D5lw XML } ],;s+ XML }][/=dvrPP# pureXML D*O'V Z*O73P,I9C|, XML PPf"D XML D5D6L}]4#Ii/"&m 6L XML }],|(+ XML D5Vb*6Lm# h*H*|, XML P(dPf"K*9CDD5)D6Lm4(GF,E\9C6L XML }]# PXhC|( XML }]4D*O53D|`E",kND*O~qwD5PD“9C6 L XML }]”# pureXML D4FMB~"<'V XML }]`MD WebSphere® Replication Server M WebSphere® Data Event Pub- lisher 'VJmz4F""LL5wgNhC DB2 }]bTf" XML }]T0gN9C pureXML &\?~4Py>Yw# ZjI>LL.s,z+\;4PBPNq: v 4(If" XML }]D DB2 }]bMm v 4(yZ XML }]Dw} v + XML D5ek= XML `MDPP v |Bf"Z XML PPD XML D5 v y] XML D5DZ]>}P v i/ XML }] v kT XML #=i$ XML D5 v 9C XSLT y=md; XML D5 C++"Java M PHP .`D&CLr`LoT'V XML }]`M#IT`4&CLr 4+ XML }]f"Z DB2 }]bmP,SmPlw}]rwC_P XML N}Df "}LrC'(eD/}# >LLG*%;Vx}]b73`4D,+z2IZVx}]b73P9C pureXML & \?~# Hvu~ Z DB2 |n0ZP,(}"v db2 -td~ |n(xP -td~ !nD db2 |n)4t / DB2 |nP&mw#1 -td !na+&/t{E(~)hC*odU9V{#8(1!VE(-t !n)TbD U9V{I7#;amsbM9C{FUdywDodri/,-rG{FUdyw 2GCVEU9D#>LLPD>}9C ~ U9V{# I+NLPD>}T;%==dkr4F"3y= DB2 |nP&mwP# {FUd:LLP9CD XML D5|,{FUd#9C|,{FUdD XML D5 1,8({FUdDyPi/MX*Yw(g(}9C CREATE INDEX od44(y Z XML }]Dw}r9C XQuery mo=4i/ XML }])Xkyw,;{FU dE\zIZ{Da{#9C|,{FUdD XML D51,yw{FUdGj<{F UdP*# NL 1:4(ITf" XML }]D DB2 }]bMm >NLhvgN9C|, XML PDm4(}]b# 1. Z Windows Yw53O,H9C db2cmd |nt/ DB2 |n0Z,;s"v db2 -td~ |n# © Copyright IBM Corp. 2006, 2013 19 Z>LLP,z+ XML }]f"Z;vmP,xKm|,_P XML `MDPDm# kq-BP=h44(>LLP9CD}]bMm: 1. (}"vTB|n44(F* XMLTUT D}]b: CREATE DATABASE xmltut~ 1!ivB,}]b9C UTF-8 (Unicode) zk/#g{!q+ XML }]f"Z 9C UTF-8 TbDzk/D}]bP,G4nCT;xPzk3*;DN=(}g BIT DATA"BLOB r XML)ekK}]#*h9Z4P XML bvZd9CV{ }]`M,Sx@9I\"zDV{f;,k+ ENABLE_XMLCHAR dCN}hC* NO# 2. k}]b,S: CONNECT TO xmltut~ 3. 4(;v{* Customer "R|,F* INFO D XML PDm: CREATE TABLE Customer (Cid BIGINT NOT NULL PRIMARY KEY, Info XML)~ f" XML }]r_T XML }]("w}1;h*9Cw|# 9IT9C ALTER TABLE SQL od+;vr`v XML PmSAm# 5XALL NL 2:4(yZ XML }]Dw} >NLhvgN4( XML }]w}#yZ XML }]Dw}ITa_i/ XML P DT\#kTzZ=JPT0gD5xP,S1519CD XML *XrtT("w }# X5w}M XML }]w} *XD Cid tT5("w }#1!ivB,T XML }]("w}.s,g{4\+K XML }]*;*8(D }]`M SQL DOUBLE,G4;a4(w}u?,2;a5Xms# 20 pureXML 8O z8(D XML #=xVs!4#}g,g{ XML D5P|, cid tTx;G Cid tT,G4b)D5kKw}+;%d# 5XALL NL 3:+ XML D5ek= XML `MPP I9C INSERT SQL od+q=NL hvgN9C INSERT SQL od+q=NLhvgN9C|nP&mw+ XML D5V/ek= XML `MPP#+G,( #a9C&CLr4ek XML D5# !\IT(}9C XML `M"~xF`MrV{`M4ek XML }],+G*K\ b"zzk3*;Jb,k9C XML `Mr~xF`M#Z>NLP,XML D5G V{DV#Zs`}ivB,;\1ST_P XML }]`MD?j8(V{.}]; zXkWH9C XMLPARSE /}4T=bv}]#+G,Z INSERT"UPDATE r DELETE YwP,IT1ST XML P8(V{.}],x;h*T=wC XMLPARSE /}#Zb}VivB,+~=bvV{.}]#PX|`E",kND XML bvD5# *+}v XML D5ek=zZNL 1 P4(D Customer m,k"vBPod: INSERT INTO Customer (Cid, Info) VALUES (1000, ’ Kathy Smith 5 Rosewood Toronto Ontario M6W 1E6 416-555-1358 ’)~ INSERT INTO Customer (Cid, Info) VALUES (1002, ’ Jim Noodle 25 EastCreek Markham Ontario N9C 3T6 905-555-7258 ’)~ INSERT INTO Customer (Cid, Info) VALUES (1003, ’ Robert Shoemaker 1596 Baseline Aurora Ontario N8X 7F8 905-555-2937 ’)~ *7OGqQI&ekG<,k"vTBod: Z 2 B pureXML LL 21 SELECT * from Customer~ 5XALL NL 4:|Bf"Z XML PPD XML D5 >NLhvgN(}+ UPDATE SQL odk XQuery |Bmo=dO9Cr_%@ 9C UPDATE SQL od4|B XML D5# ;9C XQuery |Bmo=xP|B g{z9C UPDATE odx;9C XQuery |Bmo=,G4Xk4P+D5|B# *|BzZNL 3 PekDdP;vD5D " M *XD5, k"vTBod: UPDATE customer SET info = ’ Jim Noodle 1150 Maple Drive Newtown Ontario Z9Z 2P2 905-555-7258 ’ WHERE XMLEXISTS ( ’declare default element namespace "http://posample.org"; $doc/customerinfo[@Cid = 1002]’ passing INFO as "doc")~ XMLEXISTS =J7#vf;|,tT Cid=″1002″ DD5#k"b,XMLEXISTS P D=Jmo= [@Cid = 1002] 48(*V{.HO [@Cid = ″1002″] D-r#-rZ ZzZ70 2 P* Cid tT4(w}19CK DOUBLE }]`M#*K9Cw}k Ki/%d,Z=Jmo=P;\+ Cid 8(*V{.# *7OGqQ|B XML D5,k"vTBod: SELECT * from Customer~ |, Cid=″1002″ DG" M 5# g{IT(}9C;vmDG XML P54j6KmPD XML D5,G4IT9C SQL HO=J4j6*|BDP#Z0;v>}P,XML D5PD Cid 59f"Z CUSTOMER mD CID PP,zI\Q9C CID PPD SQL HO=J4j6P#Z 0;>}P,IT+ WHERE Sdf;*TBSd: WHERE Cid=1002 9C XQuery |Bmo=xP|B g{z+ UPDATE odk XQuery |Bmo=dO9C,G4IT|BVP XML D 5D3)?V# *|BVP XML D5PDM'X7,k"vTB SQL od,|9CK XQuery d; mo=: 22 pureXML 8O UPDATE Customer set Info = XMLQUERY(’ declare default element namespace "http://posample.org"; transform copy $mycust := $cust modify do replace $mycust/customerinfo/addr with 25 EastCreek Markham Ontario N9C 3T6 return $mycust’ passing INFO as "cust") WHERE CID = 1002~ *|BM'X7,XMLQUERY /}+4Pd9Cf;mo=D XQuery d;mo=, ;s+Q|BDE"5XA UPDATE od,gBy>: v XMLQUERY +]Sd9Cj6 cust T+ XML P INFO PDM'E"+]A XQuery mo=# v Zd;mo=D copy SdP,+q!M'E"D_-lU"+d8(x $mycust d ?# v Zd;mo=D modify SdP,f;mo=af;M'E"1>PDX7E"# v XMLQUERY aZ $mycust d?P5XQ|BDM'D5# *7O XML D5Gq|,Q|BDM'X7,k"vTBod: SELECT Info FROM Customer WHERE Cid = 1002~ 5XALL NL 5:>} XML }] >NLhvgN9C SQL od4>}{v XML D5r_v>} XML D5D3)? V# >}{v XML D5 *>}{v XML D5,I9C DELETE SQL od#9C XMLEXISTS =J4j6 *>}DX(D5# *S INFO PPv>}d *X_P Cid=1003 tTDG) XML D5, k"vTBod: DELETE FROM Customer WHERE XMLEXISTS ( ’declare default element namespace "http://posample.org"; $doc/customerinfo[@Cid = 1003]’ passing INFO as "doc")~ g{IT(}9C;vmDG XML P54j6KmPD XML D5,G4IT9C SQL HO=J4j6*>}DP#Z0;v>}P,XML D5PD Cid 59f"Z CUSTOMER mD CID PP,zI\Q9CTB DELETE od4PK`,DYw,b a+ SQL HO=J&CZ CID PTj6P: DELETE FROM Customer WHERE Cid=1003~ Z 2 B pureXML LL 23 *7OGqQ>} XML D5,k"vTB SQL od: SELECT * FROM Customer~ +5X=uG<# >} XML D5D3)?V *v>} XML D5D3)?Vx;G>}{vD5,k9C|,“>} XQuery |B ”mo=D UPDATE SQL od# *S Cid D5* 1002 DM'G

}yPg0E",k"vTB9C XMLQUERY /}D SQL od: UPDATE Customer SET info = XMLQUERY( ’declare default element namespace "http://posample.org"; transform copy $newinfo := $info modify do delete ($newinfo/customerinfo/phone) return $newinfo’ passing info as "info") WHERE cid = 1002~ *}% *X,XMLQUERY /}+4Pd9C>}mo=D XQuery d;m o=,;s+Q|BDE"5XA UPDATE od,gBy>: v XMLQUERY +]Sd9Cj6 info + XML P INFO PDM'E"+]A XQuery mo=# v Zd;mo=D copy SdP,+q!M'E"D_-lU"+d8(x $newinfo d ?# v Zd;mo=D modify SdP,>}mo=a>}M'E"1>PD * X# v XMLQUERY aZ $newinfo d?P5XQ|BDM'D5# *7OM'G *X,k"vTBod: SELECT * FROM Customer WHERE Cid=1002~ 5XALL NL 6:i/ XML }] >NLhvgN9C SQL M/r XQuery(9C XQuery mo=)4i/ XML }]# g{zv9C SQL,G4;\ZP6pxPi/#2MG5,IT5Xf"ZPPD{ v XML D5,+;\ZD5ZxPi/r_5XD5,N#*Z XML D5Zi/5 r_5XD5,N,Xk9C XQuery# >NLPDi/Z SQL OBDP9C XQuery,Z XQuery OBDP9C SQL# X*Bn:XQuery xVs!4,+ SQL ;xVs!4#rK,Z9C XQuery 1, 8(ngm{M SQL #={(1!ivB,b=v{F{$d/name}’ passing INFO as "doc") FROM Customer as c WHERE XMLEXISTS (’declare default element namespace "http://posample.org"; $i/customerinfo/addr[city="Toronto"]’ passing c.INFO as "i")~ Z XMLQUERY /}P,WH8(1!{FUd#K{FUdkH0ekDD 5D{FUd%d#for Sd8((} INFO PP?vD5D *XxP|z#INFO PG9C passing Sd8(D,CSd+ INFO Ps( A for SdPy}CD doc d?#;s,return Sd9l;v *X, C*X|, for Sd?N|zzID *X# WHERE Sd9C XMLEXISTS =J4v *X(X8(D76)D5* Toronto DG)D5# K SELECT od+5XTBQ9l*X: Kathy Smith 9C db2-fn:sqlquery 1=xN} *+5+]A db2-fn:sqlquery /}PD SQL +i/,kKPTBi/: VALUES XMLQUERY ( ’declare default element namespace "http://posample.org"; for $d in db2-fn:sqlquery( ’’SELECT INFO FROM CUSTOMER WHERE Cid = parameter(1)’’, $testval)/customerinfo return {$d/name}’ passing 1000 as "testval" )~ XMLQUERY /}(}9Cj6 testval +5 1000 +]A XQuery mo=# ;s XQuery mo=(}9C PARAMETER j?/}+C5+]A db2- fn:sqlquery /}# XQuery mo=+5XTBQ9l*X: Kathy Smith Z XQuery OBDPi/ DB2 XQuery XXa)KTB=vZC/},Tk DB2 }]bdO9C:db2- fn:sqlquery M db2-fn:xmlcolumn#db2-fn:sqlquery lww* SQL +i/Da{mDr P#db2-fn:xmlcolumn S XML PPlwrP# Z 2 B pureXML LL 25 g{i/1SwC XQuery mo=,G4XkZ|0fmS;xVs!4DX|V XQUERY# ":IThC8v!n4(F|nP&mw73,XpGCZT> XQuery mo=Da {#}g,4gBy>hC -i !n,Tc|]WDA XQuery mo=Da{: UPDATE COMMAND OPTIONS USING i ON~ lw{v XML D5 *lwH0ek= INFO PPDyP XML D5,IT+ XQuery k db2- fn:xmlcolumn r db2-fn:sqlquery dO9C# 9C db2-fn:xmlcolumn *lw INFO PPDyP XML D5,kKPTBi/: XQUERY db2-fn:xmlcolumn (’CUSTOMER.INFO’)~ 1!ivB,SQL odPD{F+T/*;*s4#rK,19C CREATE TABLE SQL od4(K CUSTOMER m1,m{MP{< *s4#r* XQuery xVs!4,yTZ9C db2-fn:xmlcolumn 8 (m{MP{1Xk9C}7Ds!4# Ki/H[Z SQL i/ SELECT Info FROM Customer# 9C db2-fn:sqlquery *lw INFO PPDyP XML D5,kKPTBi/: XQUERY db2-fn:sqlquery (’SELECT Info FROM Customer’)~ z;XICs4V848( INFO {FM CUSTOMER {F,bGr * SELECT odGZ SQL OBDP&mD,rK;xVs!4# lw?V XML D5 }Klw{v XML D5.b,9IT(}+ XQuery k db2-fn:xmlcolumn r db2-fn:sqlquery dO9C4lwD5,N"}KD5PfZD5# 9C db2-fn:xmlcolumn *5X|, INFO PPyPD5D ZcD*X,b)D5z c“ *X(X8(D76)D5* Toronto,kKPTBi/: XQUERY declare default element namespace "http://posample.org"; for $d in db2-fn:xmlcolumn(’CUSTOMER.INFO’)/customerinfo where $d/addr/city="Toronto" return {$d/name}~ db2-fn:xmlcolumn /}S CUSTOMER mD INFO PPlwrP#for Sd+ $d d?s(A CUSTOMER.INFO PPD?v *X#where Sd+D5^F* *X(X8(D76)D5* Toronto DG)D5#return Sd+9ly5XD XML 5#K5G ;v *X,||,zcZ where SdPy8(u~DyPD5 D *X,gBy>: Kathy Smith 9C db2-fn:sqlquery *Z XQuery mo=P"v+i/,kKPTBi/: 26 pureXML 8O XQUERY declare default element namespace "http://posample.org"; for $d in db2-fn:sqlquery( ’SELECT INFO FROM CUSTOMER WHERE Cid < 2000’)/customerinfo where $d/addr/city="Toronto" return {$d/name}~ ZK>}P,WHZ+i/PCG XML CID PPDX(5^F*;i /D XML D5/#K>}5wK db2-fn:sqlquery DEc:|JmZ XQuery mo=P&C SQL =J#;s,Z XQuery mo=D where SdP,+ SQL i/zIDD5x;=^F* *X(X8( D76)D5* Toronto DG)D5# Ki/zzDa{k9C db2-fn:xmlcolumn D0;v>}zzDa{` ,# Kathy Smith 9C db2-fn:sqlquery 1=xN} *+5+]A db2-fn:sqlquery /}PD SQL +i/,kKPTBi /: XQUERY declare default element namespace "http://posample.org"; let $testval := 1000 for $d in db2-fn:sqlquery( ’SELECT INFO FROM CUSTOMER WHERE Cid = parameter(1)’, $testval)/customerinfo return {$d/name}~ Z XQuery mo=P,let Sd+ $testval D5hC* 1000#;s, Z for SdP,mo=a9C PARAMETER j?/}+C5+]A db2-fn:sqlquery /}# XQuery mo=+5XTBQ9l*X: Kathy Smith 5XALL NL 7:kT XML #=i$ XML D5 >NLhvgNi$ XML D5#;\kT XML #=i$ XML D5;;'VkT DTD xPi$#d;z;\kT DTD xPi$,+GT;ITek|, DOCTYPE r_}C DTD DD5# IT9C;)$_(}g,IBM Rational® Application Developer PD$_)4ozz y]wV4(dP|( DTD"mM XML D5)zI XML #=# Zi$.0,XkrZC XML #=f"b (XSR) "a XML #=#K}Lf0=" aiI XML #=D?v XML #=D5,;sjI"a#;V"a XML #=D= (G9C|n# Z 2 B pureXML LL 27 *"a#=D5MjI posample.customer XML #=D"a,kKPTB|n#(r* K XML #=vI;v#=D5iI,yTI9C%v|n4"aD5MjI"a#) K|n+8( sqllib/samples/xml ?: SELECT OBJECTSCHEMA, OBJECTNAME FROM SYSCAT.XSROBJECTS~ OBJECTSCHEMA OBJECTNAME -------------------- -------------------- POSAMPLE CUSTOMER VZ,IT9C XML #=4xPi$#(#,Z4P INSERT r UPDATE YwZ d9C XMLVALIDATE /}44Pi$#v1i$I&.s,Ea4PTd8(K XMLVALIDATE D INSERT r UPDATE Yw# *+ XML D5ek CUSTOMER mD INFO P(*sKD5TZ posample.customer XML #=P'),k"vTBod: INSERT INTO Customer(Cid, Info) VALUES (1003, XMLVALIDATE (XMLPARSE (DOCUMENT ’ Robert Shoemaker 1596 Baseline Aurora Ontario N8X 7F8 905-555-7258 416-555-2937 905-555-8743 613-555-3278 ’ PRESERVE WHITESPACE ) ACCORDING TO XMLSCHEMA ID posample.customer ))~ K>}PD XML D5w*V{}]+]#+G,XMLVALIDATE vT XML }]x PYw#r* XML D5w*V{}]4+],yTzXk9C XMLPARSE /}4T =bv}]#XMLPARSE /}+dTd?bv* XML D5"5X XML 5# DB2 } ] b ~ q w T 3 ) Y w 4 P ~ = b v # } g , 1 z Z INSERT"UPDATE"DELETE r MERGE odP+}]`M* STRING(V{" N L h v g N 9 C I ) 9 y = m o T d ; (XSLT) y = m M Z C / } XSLTRANSFORM +}]bPD XML }]*;*d{q=# T;v|,Nb}?Ds'zG Kb,Y(z#{i! XML G

StudentID Given Name Family Name Age University
*d;}]: Z 2 B pureXML LL 29 1. (}KPBP|n44(=vCZf" XML D5My=mD5Dm: CREATE TABLE XML_DATA (DOCID INTEGER, XML_DOC XML )~ CREATE TABLE XML_TRANS (XSLID INTEGER, XSLT_DOC CLOB(1M))~ 2. 9CBP INSERT od+ XML D5M{v XSLT y=mekmP# *Kr`wKp{,ZK=hP,Z~v INSERT odPT>KQXOD XSLT y =m#Z9CKod.0,k+QXODy=mf;*H0P>D XSLT y=m# INSERT INTO XML_DATA VALUES (1, ’ ’ )~ INSERT INTO XML_TRANS VALUES (1, ’ ’ )~ 3. (}wC XSLTRANSFORM /}4d; XML D5: SELECT XSLTRANSFORM (XML_DOC USING XSLT_DOC AS CLOB(1M)) FROM XML_DATA, XML_TRANS WHERE DOCID = 1 and XSLID=1~ Kd;Ddv*TB HTML D~:

StudentID Given Name Family Name Age
1 SteffenSiegmund 21
2HelenaSchmidt 23
zI\#{Dd XSLT y=mZKP1DP*,TmS4|,Z XML GmDTJ(}g,|D*4( XHTML dvx;Gj< HTML d 30 pureXML 8O v)#*DdP*,IT9CN}D~+N}+]A XSLT xL#N}D~>mG XML D5,"R|,T&Z XSLT y=mD~P`FodD param od# *9Cb)N}4*; XML D5,k+N}D~f"ZmP"+KD~k XSLTRANSFORM /}dO9C# 1. 4( PARAM_TAB m4f"N}D~: CREATE TABLE PARAM_TAB (DOCID INTEGER, PARAM VARCHAR(1000))~ 2. 4gBy>4(N}D~: INSERT INTO PARAM_TAB VALUES (1, ’ The student list ’ )~ 3. (}wC XSLTRANSFORM /}4d; XML D5: SELECT XSLTRANSFORM (XML_DOC USING XSLT_DOC WITH PARAM AS CLOB(1M) ) FROM XML_DATA X , PARAM_TAB P, XML_TRANS WHERE X.DOCID=P.DOCID and XSLID=1~ K}LDdv*TB HTML D~:

The student list

StudentID Given Name Family Name Age University
1 SteffenSiegmund 21 Rostock
2 HelenaSchmidt 23 Rostock
5XALL Z 2 B pureXML LL 31 32 pureXML 8O Z 3 B XML f"w ek=`M* XML DPPD XML D5I$tZ1!f"Tsr1Sf"Zy>mP P#y>mPf"IzXF,"RvICZ!MD5;OsDD5\Gf"Z1!f "TsP# Gq+D5f"Zy>mPP!vZf"MT\*sT0S\D==# XML f"Ts bGf" XML D5D1!=(#;\z!qgNf",h* 32 KB TOD f"Udr_,}K3s!DD5\Gf"Z1!f"TsP#f"Z1!f "TsPJmzekMlwns 2GBD XML D5# y>mPf" TZyhf"UdYZ 32 KB D XML D5,IT!q1S+ XML D5f "Zy>mPP#r*h*D I/O YwuY,yTK!naa_i/"ek" |Br>} XML D5DT\# g{TKmtC}]P9u,G4f"Z1! XML f"TsMy>mPPD XML D 5+xP9u#-}9u.s,ITa_T XML D54P I/O YwD'J,9ITu Yh*Df"Ud# XML f"Ts 1!ivB DB2 }]b~qw+`M* XML DmPP|,D XML D5f"Z XML f"TsP,LOB }]T`F==f"Z;,ZmDd{Z]D;C# XML f"Tsk|GD8mTsGV*D,+f"Ts@5Z8mTs#TZf"Z XML mPDPPD?v XML 5,DB2 mPf"w I!q+!MMPM XML D5f"Zy>mPP,x;G+|Gf"Z1! XML f "TsP#XML D5DPf"`FZa9/`M5}T1SekD==f"ZmPPD iv# ZtCy>mPf".0,h*v(*+`YPUdCZ?v XML PDPf"#Ia )DUd!vZICDnsPs!,xnsPs!V!vZ4(mDmUdD3s! © Copyright IBM Corp. 2006, 2013 33 T08(*mD;?VDd{P#*FcICDPUd,kND XML PD“Ps!”M“ VZF}”T0“CREATE TABLE od”P8(D“INLINE LENGTH”# tCy>mPf" IZ4(|, XML PDmrDd|, XML PDVPm1,8(XML D5&f"Z y>mPPx;Gf"Z1! XML f"TsP*tCy>mPf",TZ&9CPf "D?v XML P,h*+ INLINE LENGTH X|Vk CREATE TABLE r ALTER TABLE od|(Z;p,sz*f"Zy>mPPD XML D5Dnss!(TVZ F)# "b,DdVPmD XML P;a+Q-f"ZCPPD XML D5T/F=y>mP P#*F/ XML D5,Xk9C UPDATE od|ByP XML D5# ^F y>mPf"vI)Z?m>;,} 32 KB(g{Ps!O!,G4a|!)D XML D59C,,1h*u%8(K INLINE LENGTH !nD XML PDXhVZF}* z#32 KB s!Y(mUd3s!* 32 KB#f",}8(1Sek$HD XML D 51,,}s!DD5+T/f"Z1! XML f"TsP# ;)T XML P8(K1Sek$H,M;\a_CZ XML D5DPf"D1Sek $Hs!,+;\5MCs!# >} TB>}T SAMPLE }]bPD PRODUCT mD XML P DESCRIPTION tC XML D5Dy>mPf"#K>}+*f"Zy>mPPD XML D5Dns1Sek$H hC* 32000 VZ,ba**ztBnbyhUd#9C5“32000 VZ”1Y(mUd 3s!* 32 KB#Dd XML Ps,UPDATE oda+ XML D5F=y>mPP# ALTER TABLE PRODUCT ALTER COLUMN DESCRIPTION SET INLINE LENGTH 32000 UPDATE PRODUCT SET DESCRIPTION = DESCRIPTION TB>}4(D MYCUSTOMER mk SAMPLE }]bD CUSTOMER m`F,+d y>mPf"GT XML P Info 8(D#ek= INFO PP1,Z?m>;,} 2000 VZDD5+f"Zy>mPP# CREATE TABLE MYCUSTOMER (Cid BIGINT NOT NULL, Info XML INLINE LENGTH 2000, History XML, CONSTRAINT PK_CUSTOMER PRIMARY KEY (Cid)) in IBMDB2SAMPLEXML XML D5Df"*s XML D5Z DB2 }]bPyr_PrLDtT5,G4CD5Z] iID XML D5*`# Zc{ *X{F"tT{F"{FUd0:T0`FDGZ]}]D$H20lf" wDs!#9u- 9.5 r|Mf>D XML GmPP,x;G+|Gf"Z1! XML f"TsP# >}:y>}]b|,;vM'}]m,||,=v XML P#(egBy>: CREATE TABLE Customer (Cid BIGINT NOT NULL PRIMARY KEY, Info XML, History XML) >}:VALIDATED =JliGqi$K8(D XML PPD5#IT9C VALI- DATED =J(eT XML PDmli}:+ COMPRESS tThC* YES MatC}]P9u#f"Z XML PPD XML D5+xPP9u#9uP6pD}]1,Jm+X4D#=f;*|LD{EV {.# CREATE TABLE TableXmlCol (id BIGINT, xmlcol XML) COMPRESS YES >}:TB CREATE TABLE od4(4=CUZVxD<_m#iZ 2000 j 1 B 1 U= 2006 j 12 B 31 U.dDyPG} y>}]b|,;vM'}]m,||,=v XML P#(egBy>: CREATE TABLE Customer (Cid BIGINT NOT NULL PRIMARY KEY, Info XML, History XML) 4(;v{* MyCustomer Dmw* Customer D1>,"mS;v XML P4hvM 'D2C# CREATE TABLE MyCustomer LIKE Customer; ALTER TABLE MyCustomer ADD COLUMN Preferences XML; >}:+ COMPRESS tThC* YES MatC}]P9u#f"Z XML PPD XML D5+xPP9u#9uP6pD}]1,Jm+X4D#=f;*|LD{EV {.# ALTER TABLE MyCustomer ADD COLUMN Preferences XML COMPRESS YES; >}:TB CREATE TABLE od4(4=CUZVxD<_m#iZ 2000 j 1 B 1 U= 2006 j 12 B 31 U.dDyPG}5wKgN+ XML }]ek= XML PP#b)>}9Cm MyCustomer, |Gy> Customer mD1>#*ekD XML }]ZD~ c6.xml P,"R4p4g By>: Christine Haas 12 Topgrove Toronto Ontario N8X-7F8 905-555-5238 416-555-2934 >}:Z JDBC &CLrP,T~xF}]DN=A!D~ c6.xml PD XML }], "+}]ek= XML PP: PreparedStatement insertStmt = null; String sqls = null; int cid = 1015; sqls = "INSERT INTO MyCustomer (Cid, Info) VALUES (?, ?)"; insertStmt = conn.prepareStatement(sqls); insertStmt.setInt(1, cid); File file = new File("c6.xml"); insertStmt.setBinaryStream(2, new FileInputStream(file), (int)file.length()); insertStmt.executeUpdate(); >}:Z2,6k= C &CLrP,+}]S~xF XML wd?ek= XML PP: EXEC SQL BEGIN DECLARE SECTION; sqlint64 cid; SQL TYPE IS XML AS BLOB (10K) xml_hostvar; EXEC SQL END DECLARE SECTION; ... cid=1015; /* Read data from file c6.xml into xml_hostvar */ ... EXEC SQL INSERT INTO MyCustomer (Cid,Info) VALUES (:cid, :xml_hostvar); XML bv XML bvG+ XML }]SdrP/V{.q=*;*Vcq=D}L# ITC DB2 }]b~qw~=4Pbv,2ITT=4P XML bv# ZBPivBxP~= XML bv: v 9C`M* XML Dwd?r9C`M* XML DN}jG+}]+]A}]b~q w1 }]b~qwZs(wd?rN}jGD5TcZod&mZd9C1xPbv ZbVivB,Xk9C~=bv# v Z INSERT"UPDATE"DELETE r MERGE odP+V{.}]`M (character"graphic r binary)Dwd?"N}jGr SQL mo=8(x XML P 1#1 SQL `kw~=+ XMLPARSE /}mSACod1xPbv# Z 4 B ek XML }] 39 Tdk XML }]wC XMLPARSE /}1,4PT= XML bv#ITZS\ XML }]`MDNNOBDP9C XMLPARSE Da{#}g,IT+a{8(x XML P r+|Cw`M* XML Df"}LN}# XMLPARSE /}ICG XML"V{r~xF}]`Mw*dk#TZ6k=/, SQL &CLr,h*+m> XMLPARSE DdkD5DN}jG*;*`&D}]`M#} g: INSERT INTO MyCustomer (Cid, Info) VALUES (?, xmlparse(document cast(? as clob(1k)) preserve whitespace)) TZ2,6k= SQL &CLr,;\+ XMLPARSE /}Dwd?Td?yw* XML `M(XML AS BLOB"XML AS CLOB r XML AS DBCLOB `M)# XML bvMUq&m Z~=rT= XML bvZd,+}]f"Z}]bP1,ITXFG#t9G%t_ gUqV{# y] XML j<,UqGD5PCZa_IATDdtV{(U+0020)"X5{ (U+000D)";P{(U+000A)rFm{(U+0009)#1NNb)V{w*D>V {.D;?VvV1,;+|GS*Uq# _gUqGvVZ*X.dDUqV{#}g,ZTBD5P, k T0 k .dDUqG_gUq# and between (}T=wC XMLPARSE,IT9C STRIP WHITESPACE r PRESERVE WHITESPACE !n4XFGq#t_gUq#1!P*G%t_gUq# (}~= XML bv: v g{dk}]`M;G XML `Mr4*;* XML }]`M,G4 DB2 }]b~ qw\G%tUq# v g{dk}]`MG XML }]`M,G4IT9C CURRENT IMPLICIT XMLPARSE OPTION (CDfw4XFGq#t_gUq#IT+K(CDfwh C* STRIP WHITESPACE r PRESERVE WHITESPACE#1!P*G%t_gU q# g{9C XML i$,G4 DB2 }]b~qw+vT CURRENT IMPLICIT XMLPARSE OPTION (CDfw,";9Ci$fr47(BP>}PG%t9G# tUq: xmlvalidate(? ACCORDING TO XMLSCHEMA ID schemaname) xmlvalidate(?) xmlvalidate(:hvxml ACCORDING TO XMLSCHEMA ID schemaname) xmlvalidate(:hvxml) xmlvalidate(cast(? as xml) ACCORDING TO XMLSCHEMA ID schemaname) xmlvalidate(cast(? as xml)) ZKivB,? m> XML }],x :hvxml G XML wd?# PX XML i$gN0lUq&m==DE",kND XML i$# 40 pureXML 8O XML j<8( xml:space tT,|CZXFG%t9G#t XML }]PDUq# xml:space tT2GNNUqhCTxP~=rT= XML bv# }g,ZTBD5P,^[ XML bv!ngN,\G#t}CZ 0sDUq, r*b)Uq;Z_PtT xml:space="preserve" DZcZ: cb +G,ZTBD5P,ITC XML bv!nXF}CZ 0sDUq,r*b) Uq;Z_PtT xml:space="default" DZcZ: cb G Unicode }]bPD XML bv + XML D5+]AG Unicode }]b1,WHD5SM'z+]A?j}]b~q w1axPzk3*;,;sZD5+]A DB2 XML bvw1axPzk3*;#9 C`M* XML Dwd?rN}jG+] XML D5I\bxPzk3*;#g{9C V{}]`M(CHAR"VARCHAR"CLOB r LONG VARCHAR)+] XML D5, G4zk3*;I\(sZE)V{# 9I9C ENABLE_XMLCHAR dCN}4XFGqTV{}]`MtC XML bv# + ENABLE_XMLCHAR hC*“NO”Ih99CV{}]`M1DT=M~= XML b v# XML bvM DTD g{dk}]|,Z?D5`Myw(DTD)r}Cb? DTD,G4 XML bv}L 9alib) DTD Do(#Kb,bv}L9: v &CZ?Mb? DTD (eD1!5 v )95e}CMN}5e >} TB>}5wZ;,ivBgN&m XML D5PDUq# >}:D~ c8.xml |,TBD5: Kathy Smith 14 Rosewood Toronto Ontario M6W 1E6 416-555-3333 Z 4 B ek XML }] 41 Z JDBC &CLrP,SD~PA! XML D5,;s+}]ek=m MYCUSTOMER D XML P INFO P,CmGy> Customer mD1>#C DB2 }]b~qw4P~ = XML bvYw# PreparedStatement insertStmt = null; String sqls = null; int cid = 1008; sqls = "INSERT INTO MyCustomer (Cid, Info) VALUES (?, ?)"; insertStmt = conn.prepareStatement(sqls); insertStmt.setInt(1, cid); File file = new File("c8.xml"); insertStmt.setBinaryStream(2, new FileInputStream(file), (int)file.length()); insertStmt.executeUpdate(); 4 8 ( U q & m = = , r K I C 1 ! P * : % t U q # + G , D 5 | , xml:space="preserve" tT,rK#tUq#bm>+#tD5P*X.dDX5{" ;P{MUq# g{lwf"D}],G4Z]4p4gBy>: Kathy Smith 14 Rosewood Toronto Ontario M6W 1E6 416-555-3333 >}:Y(TBD5;Z BLOB wd? blob_hostvar P# Kathy Smith 15 Rosewood Toronto Ontario M6W 1E6 416-555-4444 Z2,6k= C &CLrP,+wd?PDD5ek=m MyCustomer D XML P Info P#Cwd?;G XML `M,rKh*T=4P XMLPARSE#8( STRIP WHITESPACE T}%NN_gUq# EXEC SQL BEGIN DECLARE SECTION; SQL TYPE BLOB (10K) blob_hostvar; EXEC SQL END DECLARE SECTION; ... EXEC SQL INSERT INTO MyCustomer (Cid, Info) VALUES (1009, XMLPARSE(DOCUMENT :blob_hostvar STRIP WHITESPACE)); D5|, xml:space="default" tT,rK8(K STRIP WHITESPACE D XMLPARSE +XFUq&m==#bm>+}%D5P*X.dDX5{";P{M Uq# g{lwf"D}],G4z+4=_PTBZ]D%vP: 42 pureXML 8O Kathy Smith15 Rosewood TorontoOntarioM6W 1E6 416-555-4444 >}:Z C oT&CLrP,wd? clob_hostvar |,TBD5,CD5|,Z? DTD: ]> &desc;
Very heavy
9.99 1 kg
’ +}]ek=m MYPRODUCT P,CmGy> PRODUCT mD1>: EXEC SQL BEGIN DECLARE SECTION; SQL TYPE CLOB (10K) clob_hostvar; EXEC SQL END DECLARE SECTION; ... EXEC SQL insert into Product ( pid, name, Price, PromoPrice, PromoStart, PromoEnd, description ) values ( ’110-100-01’,’Anvil’, 9.99, 7.99, ’11-02-2004’,’12-02-2004’, XMLPARSE ( DOCUMENT :clob_hostvar STRIP WHITESPACE )); XMLPARSE 8(%tUq,rK+}%D5ZD_gUq#Kb,Z}]b~qw4 P XMLPARSE 1,|+5e}C &desc; f;*|D5# g{lwf"D}],G4z+4=_PTBZ]D%vP: Anvil
Very heavy
9.99 1 kg
XML }]j{T h*7# XML D5q-X(frrzcX(&m*s,I4P=S XML }]j{T lir8(4PYw0Xk{OD=Su~# a)K7# XML }]j{TD;);,=(,y!D=(!vZX(}]j{TM& m*s# g{** XML D5("w},9I?FZyPD5D XML PP(;,dZcIzT d("w}D XML #=^(#kND“UNIQUE X|Voe”TKb|`E"# XML PDli}{OX(i$u~DD5,G49C VALI- DATED =J4a)u~#"b,lim;} XML #=D XSR Ts,G4 9a>}}CC#=DNN} >}:v!qQi$ XML D5#Y(Zm T1 P(eKP XMLCOL#vlwQ-} NN XML #=i$D XML 5# SELECT XMLCOL FROM T1 WHERE XMLCOL IS VALIDATED >}:?F5)TBfr:}G-}i$,qr;aekr|BNN5#Y(Zm T1 P(eKP XMLCOL "R+li}:}Ywvvl&D%"w,k9C CREATE TRIGGER odT XML 4(xP INSERT"UPDATE r DELETE !nD BEFORE r AFTER %"w# Z%"wweP,}C\0lPP`M* XML DPD*;d?;\k XMLVALIDATE /}dO9CxPi$,T+ XML P5hC* NULL,r#t XML P5;d# Z XML PPf" XML D5.0,I9Ck INSERT r UPDATE oddO9CD BEFORE %"w4T/i$b)D5#T"a XML #=i$ XML D5GI!Yw, +?R(i}]j{T;7(1byv,-rGbyIT7#;ekr|BP'D XML D5# zchCu~1a$n%"w;g{48(NNu~,%"w\G&Z$n4,#g {#{v1X*1E%"T XML D5Di$,G4I8( XML PDu~0 BEFORE %"wD WHEN Sd#Z WHEN SdP,I|(T XML D5DXhi$4,:4 b)D5XkQi$r_;(;\i$b)D5T$n%"w(IS VALIDATED r IS NOT VALIDATED)#I!q(}8( ACCORDING TO XMLSCHEMA Sd4|( ;vr`v XML #=,Tf_%"wZT},G4%"wa;jG*;IYw# >} 1:4(TB BEFORE %"w:Z SAMPLE }]bD PRODUCT mPek| ,Bz7hvD XML D5.0,C%"waT/i$b)D5#K%"waZ|B XML D5.0DNb1d$n# Z 4 B ek XML }] 45 CREATE TRIGGER NEWPROD NO CASCADE BEFORE INSERT ON PRODUCT REFERENCING NEW AS N FOR EACH ROW MODE DB2SQL BEGIN ATOMIC SET (N.DESCRIPTION) = XMLVALIDATE(N.DESCRIPTION ACCORDING TO XMLSCHEMA URI ’http://posample.org/product.xsd’); END >} 2:]x XML #= product2.xsd .s,Q-f"D XML D5Z]x#=B# $P',;*|GT-< XML #= product.xsd P'#+G,zI\k*7#Tb) XML D5DyP|BZ]x#= product2.xsd B,yP'#r XML #=f"b"a product2.xsd Ts,BEFORE UPDATE %"waZxPNN|B0i$ XML D5: CREATE TRIGGER UPDPROD NO CASCADE BEFORE UPDATE ON PRODUCT REFERENCING NEW AS N FOR EACH ROW MODE DB2SQL BEGIN ATOMIC SET (N.DESCRIPTION) = XMLVALIDATE(N.DESCRIPTION ACCORDING TO XMLSCHEMA ID product2); END >}:zk*Zm;vmPG}P,Iy]m MyCustomer D XML PE"4(%"w,CmGy> Cus- tomer mD1>#?NZ MyCustomer mPekr|BG<1,b)%"wa}(>} 4)rT>g NZ CustLog mP#t5J}]D1># WHT MyCustomer m4( AFTER INSERT %"w: CREATE TRIGGER INSAFTR AFTER INSERT ON MyCustomer REFERENCING NEW AS N FOR EACH ROW BEGIN ATOMIC INSERT INTO CustLog VALUES(N.CID, CURRENT TIMESTAMP, ’Insert’); END ;sT MyCustomer m4( AFTER UPDATE %"w: CREATE TRIGGER UPDAFTR AFTER UPDATE OF Info ON MyCustomer REFERENCING NEW AS N FOR EACH ROW BEGIN ATOMIC INSERT INTO CustLog VALUES(N.CID, CURRENT TIMESTAMP, ’Update’); END >} 4:K>}5wgNhC;vm,Cm+w*QekrQ|BM'G#k>} 3 `,,z4(=v%"w,;v AFTER INSERT CZBekDG<, ;v AFTER UPDATE CZ|BDG<#Iy]m MyCustomer D XML PE"4( %"w,CmGy> Customer mD1>#?NZ MyCustomer mPekr|BG<1, b)%"wam;XZ}]bPM\;Z XMLVALIDATE P xPi$: XML i$MIvTUq y] XML j<,UqGD5PCZa_IATDdtV{(U+0020)"X5{ (U+000D)";P{(U+000A)rFm{(U+0009)#1NNb)V{w*D>V {.D;?VvV1,;+|GS*Uq# IvTUqGIS XML D5P}%DUq#XML #=D57(DvUqGIvTU q#g{ XML D5(ev*X4S`M(v|,d{*XD*X),G4IvT*X .dDUq#g{ XML #=(e|,GV{.`MDr%*X,G4IvTC*XZ DUq# >}:4gBy>(ey> XML #=D5 product.xsd PD description *X: Z 4 B ek XML }] 47 ... description *X_Pv*X4S`M,r*|;|,d{*X#rK,description * XPD*X.dDUqGIvTUq#price *X2IT|,IvTUq,r*|G| ,GV{.`MDr%*X# Z XMLVALIDATE /}P,ITT=8(*CZi$D XML #=D5#g{;8( XML #=D5,G4 DB2 }]b~qw+ZdkD5PiRj6 XML #=D5D xsi:schemaLocation r xsi:noNamespaceSchemaLocation tT#xsi:schemaLocation r xsi:noNamespaceSchemaLocation tTI XML #=f6(e,F* XML #=a># xsi:schemaLocation tT|,;vr`v5T,|GIoziR XML #=D5#?v 5TPDZ;v5G{FUd,Z~v5Ga>,|8>{FUdD XML #=D; C#xsi:noNamespaceSchemaLocation 5;|,a>#g{ XML #=D5GZ XMLVALIDATE / } P8( D , G 4 | + 2G xsi:schemaLocation r xsi:noNamespaceSchemaLocation tT# BP>}Y( product #=GZ XML #=f"b (XSR) P"aD#IT9CngT BD CLP od4jI"a: REGISTER XMLSCHEMA http://posample.org/product.xsd FROM product.xsd \ AS myschema.product COMPLETE XMLSCHEMA myschema.product r_,r* XML #=I%v#=D5iI,yTIT9C%vod4"a XML #= "jI"a: REGISTER XMLSCHEMA http://posample.org/product.xsd FROM product.xsd \ AS myschema.product COMPLETE >}:Y(4gBy>4(m MyProduct: CREATE TABLE MyProduct LIKE Product z*9C/, SQL &CLr+TBD5ek= MyProduct mD XML P Info P," R*kT XML #=D5 product.xsd i$ XML }],CD5;Z MyProduct my ZD}]b~qwOD XML #=f"bP# Anvil
Very heavy
9.99 1 kg
’ Z INSERT odP,XMLVALIDATE /}8(*CZi$D XML #=: Insert into MyProduct (pid, name, Price, PromoPrice, PromoStart, PromoEnd, description) values ( ’110-100-01’,’Anvil’, 9.99, 7.99, ’11-02-2004’,’12-02-2004’, XMLVALIDATE(? ACCORDING TO XMLSCHEMA ID myschema.product)) lwf"D}]1,zIT4= XMLVALIDATE }%IvTUqD;C#lw=D} ]G_PTBZ]D%vP: 48 pureXML 8O Anvil
Very heavy
9.991 kg
product #=(e name"details"price M weight *X\'DUq,dP price * XZDUq(e*IvTUq,rK XMLVALIDATE +}%CUq# g{h*7#v+Qi$DD5ek= XML PP,rvS XML PPlwQi$DD 5,G49C VALIDATED =J# *bTGqZekr|B XML D50i$KCD5,kT XML P4(|, VALI- DATED =JDli}:Y(zkS MyCustomer mD INFO PP;lwQi$D XML D5#4P` FTBD SELECT od: SELECT Info FROM MyCustomer WHERE Info IS VALIDATED >}:Y(zk+Qi$D XML D5;ek= MyCustomer mD INFO PP#IT (eli}PD VALIDATED =J,r*;\ZmP I&ekr|BP'D5# >}:Y(zk*9C customer #=i$TBD5,+;k+|f"Z}]bP# Kathy Smith 25 Rosewood Toronto Ontario M6W 1E6 416-555-6676 Y(Q+D58(x&CLrd?#IT9C`FTBD VALUES od4xPi$: VALUES XMLVALIDATE(? according to xmlschema id myschema.customer) y] XML #=KD5P',rK VALUES od5X|,CD5Da{m#g{CD 5^',G4 VALUES 5X SQL ms# XSR_GET_PARSING_DIAGNOSTICS f"}L f"}L XSR_GET_PARSING_DIAGNOSTICS zIbvri$ XML D51y"zm sDj8E"#Kf"}LICZ(fbvmsMi$msrv(fbvms# Z 4 B ek XML }] 49 g { Z b v r i $ XML D ~ Z d " z m s , k S DB2 | n 0 Z w C XSR_GET_PARSING_DIAGNOSTICS f"}Lr_+Kf"}LmSA&CLr#} g,9C XMLVALIDATE j?/}i$ XML D51,k9CKf"}L4zIi$ Zdy"zmsDj8E"# o( XSR_GET_PARSING_DIAGNOSTICS ( instance , rschema , name , schemaLocation , implicitValidation , errorDialog , errorCount ) Kf"}LD#=* SYSPROC# (^ XML #=Z(:CZi$D XML #=XkZ XML #=f"bP"a.sE\9C# Kf"}LDZ(j6XkAY5PBPdP;nX(M(^: v TCZi$D XML #=D USAGE X( v DBADM (^ }LN} instance BLOB(30M) `MDdkN},||, XML D5DZ]#Xka) XML D5# K5;\* NULL# rschema VARCHAR(128) `MDdkN},|8(r XML #=f"b"aD=?V XSR Ts{D SQL #=?V#K5I* NULL#g{K5* NULL,G4Y( SQL # =?VG CURRENT SCHEMA (CDfwD105# name VARCHAR(128) `MDdkN},|8(r XML #=f"b"aD=?V XSR Ts{D#={#XML #=Dj{ SQL j6* rschema.name#|TZ XSR P DyPTs&CG(;D#K5I* NULL# schemaLocation VARCHAR(1000) `MDdkN},|8> XML #=wD5D#=;C#KN} G XML #=Db?{,4,ITZ XML 5}D5P9C xsi:schemaLocation tT4j6wD5#K5I* NULL# implicitValidation INTEGER `MDdkN},|8>Gq&C9C5}D5PD#=;C4iR XML #=#K5;\* NULL#|D5IT* 0(m>“q”)M 1(m>“G”)# 0 ;9C5}D5PD#=;C#g{+]D5* 0,G4IT9CBPdP;V =(48(#=: v + XSR Ts{w*Z XML #=f"bP"aD#=D rschema M name N}4a)# v 9C schemaLocation N}4a)#=;C# 50 pureXML 8O g{,18(K XSR Ts{M schemaLocation,G4+9C XSR Ts{#g {48(NN;n,G4;a4Pi$#v4P XML bv,"(fyP XML bvms# 1 9C5}D5PD xsi:schemaLocation tT5D#=;C# y]H0r XML #=f"b"aD XML #=D54TdkD54Pi$# g{ implicitValidation N}D5* 0,x rschema"name M schemaLocation N} D5* NULL,G4+bv5}D5+;aT|xPi$# errorDialog VARCHAR(32000) `MDdvN},||,+P>bvMi$msD UTF-8 XML D5#v1AYP;vms1,EazIKD5# errorCount `M* INTEGER DdvN},CZ8( XML bvMi$msD\}# C( IT(}TB}V=(4kTQ"aD XML #=i$ XML D5: v 9C rschema M name N}* XML #=a) XSR Ts{# v 9C schemaLocation N}4a)#=;C# v g{ XML 5}D5+#=8(* xsi:schemaLocation tTD5,G4+ implicitValidation hC* 1# g{9C XSR_GET_PARSING_DIAGNOSTICS f"}L1"zbvri$ms,G4 hC errorDialog M errorCount dvN}#errorDialog |,;vCZP>msD XML D 5 # I T S 9 C CLI" Java r C++ D &CL r P w C XSR_GET_PARSING_DIAGNOSTICS f"}L,"9CN}jG4q!Kf"}LD dv# T>j8D XML bvMi$ms IT9C XSR_GET_PARSING_DIAGNOSTICS f"}LP errorDialog dvN}P DE"4bv XML bvMi$ms# g{9C XMLVALIDATE j?/}4i$ XML D51"zms,G4k9C XSR_GET_PARSING_DIAGNOSTICS f"}L4zIj8DmsE"#TB>}+ XSR_GET_PARSING_DIAGNOSTICS f"}Lkr%D XML #=M XML D5dO 9C4zIj8Di$msE"# y> XML #= K>}9CTB XML #=(e(XSD)#K#=_PwV*X,dP INTEGER `M tTD*X8(x Age *X# Z 4 B ek XML }] 51 y> XML D5 TB XML D5+Iy> XML #=xPi$#KD5;{O3)#=fr#Age * XD5;G}V,"RZK#=P4+ Notes® *X(e* Person *XDS*X# Thomas Watson 30x C4"a XML #=D|n Z9C XSR_GET_PARSING_DIAGNOSTICS f"}L4i$ XML D5.0,XkZ DB2 XML #=f"b (XSR) P"aCZi$D XML #=#TB REGISTER XMLSCHEMA |nY(#=;Z c:\temp\simpleschema.xsd P,"R SQL #=* USER1: REGISTER XMLSCHEMA ’http://my.simpletest/simple’ FROM ’file:///c:/temp/simpleschema.xsd’ AS user1.simple COMPLETE wCTzIj8Di$msE" TBwCS CLP 9C XSR_GET_PARSING_DIAGNOSTICS f"}L4zIi$msE": CALL XSR_GET_PARSING_DIAGNOSTICS( blob(’ Thomas Watson 30x ’),’’,’’,’’,1,?,?)@ j8Di$msE" wC XSR_GET_PARSING_DIAGNOSTICS f"}L+5XTBdv#errorDialog N }D5G;v|,i$msj8E"D XML D5#ZK XML D5P,errText" 52 pureXML 8O location"lineNum M colNum *XDZ]j6X(msT0"zmsD;C#S CLP |nPKPH0wC1,TBdv+4Aj 238 http://apache.org/xml/messages/XML4CErrors Datatype error: Type:InvalidDatatypeValueException, Message:Value ’30x’ does not match regular expression facet ’[+\-]?[0-9]+’ . 1 272 /Person/Age http://www.w3.org/2001/XMLSchema:integer 2 30x 13 2 http://apache.org/xml/messages/XMLValidity Unknown element ’Notes’ 1 282 /Person http://www.w3.org/2001/XMLSchema:integer 2 Notes 37 7 http://apache.org/xml/messages/XMLValidity Element ’Notes’ is not valid for content model: ’(Name,Age)’ 1 292 /Person http://www.w3.org/2001/XMLSchema:anyType 2 Notes 31 2200M -16210 [IBM][CLI Driver][DB2/NT] SQL16210N XML document contained a value "30x" that violates a facet constraint. Reason code = "13". SQLSTATE=2200M Parameter Name : ERRORCOUNT Parameter Value : 3 5X4, =0 v?Dms{"'VD ErrorLog XML #=(e ErrorLog XML #=(e(XSD)hvZ XML D5PzzbvMi$msDivBI XSR_GET_PARSING_DIAGNOSTICS f"}LzID UTF-8 XML D5#dv XML D5f"Z errorDialog N}P# Z 4 B ek XML }] 53 ErrorLogType XML #=(eDy*XG ErrorLog "Rd`M* ErrorLogType# XML #=(e S*X XML_Error XML_FatalError `M: XML_ErrorType 9C5w: XML_Error r XML_FatalError *X|, XML bvwzIDms{ "#XML_Error M XML_FatalError *X_P`,D XML #=`M# XML_FatalError G XML_ErrorType *X|,BPS*X: errCode XML bvw5XDmszk# errDomain XML bvw5XDmsr# errText -(fK`YjGD}V5# token jGGC4zI DB2 ms{"DV{.5# tT bvw(XkD) bvwtT8(9CDWc XML bvw# DB2_Error `M: DB2_ErrorType 9C5w: DB2_Error *X|, DB2 ms{"# DB2_ErrorType *X|,BPS*X: sqlstate SQLSTATE sqlcode SQLCCODE errText DB2 ms{" v?Dms{"'VD XML #= XSR_GET_PARSING_DIAGNOSTICS f"}L+zIPXZbvMi$ XML D5Z dyzzmsDj8E"#KE"w* XML D5zI#K#=(ef"}LDP' XML dv# TBPmm>I XSR_GET_PARSING_DIAGNOSTICS f"}LzID XML D5D ErrorLog XML #=# Z 4 B ek XML }] 55 ZG Unicode }]bP9C XML Sf> 9.5 *<,IZ;9C Unicode zk3D}]bPf""lw XML }]# SZ?44,XML }]}]bkSM'zr&CLrekD XML D5V{..dDwVI\`ki O#r*M'z(}V{}]`Mek XML }],yT XML D5`kkM'zzk 3f`,#TZ?ViO,+hvzk3*;D0lM XML D5ekZdDa{V{ f;I\T# m 2. }]bkekD XML D5V{..dD`k=8 =8 XML D5`k }]b`k zk3Gq%d? 1. Unicode (UTF-8) Unicode (UTF-8) G 2. G Unicode Unicode (UTF-8) q 3. G Unicode G Unicode G 4. Unicode (UTF-8) G Unicode q 5. G Unicode G Unicode q 1. Z=8 1 P,XML D5M}]b2C Unicode `k#ek XML D51;axP NNV{*;#TK==ek XML }]”)D.yxFM.xFH[n# ZG Unicode }]bPi/ XML }] kZ}]bPek XML }];y,Zf0 XML }]Di/Zd7#}]j{TDn 2+=(G9C Unicode }]b#g{;\9CK=(,G4I(}7#yP XML } ]Z}]bzk3PIm>4\bV{f;,r_(}T}]bzk3P4|,DV {9CV{5e}C4\bV{f;# g{i/|,D XML Z]|(Z}]bzk3P;Im>DV{,G4I\a"zB P=V`MDV{f;,Sx*JE (“?”)#+ XML }]S}]bzk3*;* Unicode 1,a#tf;V{# f;*nS|DV{H[n(“~O”) -} 2 Pwv5w# >} TB>}5w9C UTF-8 `kDM'zr&CLrCZi/G Unicode }]bPD XML }]1*;zk3I\x4D0l#Zb)>}P,Y(}]bG9Czk3 58 pureXML 8O ISO8859-7(#0o)4(D#XQuery mo=CZ%dm T1 Pf"D XML }],d PQf" XML }]I Unicode #0owqjV{(ΣG)M Unicode cuwqjV{ (ΣM)iI#zkc 0xD3 Z ISO8859-7 }]bPj6wqjV{# m T1 G9CBP|n4("ndD: CREATE TABLE T1 (DOCID BIGINT NOT NULL, XMLCOL XML); INSERT INTO T1 VALUES (1, XMLPARSE( document ’ ΣG ΣM ’ preserve whitespace)); >} 1:I&Dzk3*;(V{Z}]bzk3PGIm>D) XQUERY for $test in db2-fn:xmlcolumn("T1.XMLCOL")//*[. = "ΣG"] return $test Kmo=zIZ{Da{: ΣG ZKivB,mo= ΣG ZM'zOT#0owqjV{ (U+03A3) D Uni- code zkc*7,*;*#0o}]bzk3 (0xD3) PDwqjV{,;s Y*;X}7D Unicode V{TxP XML &m#r*#0owqjV{Z} ]bzk3PGIm>D,yTmo=a}7%d#KV{*;T>ZBm P: m 3. V{}]*;(>} 1) M'z (UTF-8) }]b (ISO8859-7) XML bvw (UTF-8) V{ U+03A3(#0 owqj) → 0xD3(#0o wqj) → U+03A3(#0 owqj) >} 2:;I&Dzk3*;(V{Z}]bzk3PG;Im>D) XQUERY for $test in db2-fn:xmlcolumn("T1.XMLCOL")//*[. = "ΣM"] return $test Kmo=4zIZ{Da{: ΣG ZKivB,mo= ΣM ZM'zOTcu{Ewqj(U+2211)D Unicode zkc*7,*;*#0o}]bzk3(0xD3)PDwqjV{,;sZ xP XML HO1k ΣG V{`%d#TZ5Xmo=,}Lk>} 1 Pj+ `,#Unicode XML V{ ΣG H*;*#0o}]bzk3PDwqjV{ (ΣA),;s*;*M'z UTF-8 zk3(ΣG)PD#0owqjV{#KV {*;T>ZBmP: m 4. V{}]*;(>} 2) M'z (UTF-8) }]b (ISO8859-7) XML bvw (UTF-8) V{ U+2211(cu wqj) → 0xD3(#0o wqj) → U+03A3(#0 owqj) >} 3:9CV{5e}CF}zk3*; XQUERY for $test in db2-fn:xmlcolumn("T1.XMLCOL")//*[. = "ࢣ"] return $test Z 4 B ek XML }] 59 Kmo=zIZ{Da{: ΣM ZKivB,mo= ΣM ZM'zOTcu{Ewqj(U+2211)*7,r* |*e*V{}C ࢣ,yTZ+]A XML bvw1a#t Unicode z kc,Sx\;TQf" XML 5 ΣM xPI&DHO#F}V{*;D}L T>ZBmP: m 5. V{}]*;(>} 3) M'z (UTF-8) }]b (ISO8859-7) XML bvw (UTF-8) V{ U+2211(cu wqjDV{} C) → ″ࢣ″(cu wqjDV{} C) → U+2211(cu wqj) >} 4:;I&Dzk3*;(V{Z}]bzk3PG;Im>D) K>}k>} 1 `F,+K&9C ASCII `k}]b"RaZ XML mo= P}kzk3D1!f;V{# XQUERY for $test in db2-fn:xmlcolumn("T1.XMLCOL")//*[. = "ΣG"] return $test Ki/4\%dm T1 PD}75#ZKivB,Unicode V{ U+2211(#0 owqj)Z ASCII zk3P;P%dzkc,yTa}k1!f;V{,Z KivB*JE(“?”)#KV{*;T>ZBmP: m 6. V{}]*;(>} 4) M'z (UTF-8) }]b (ISO8859-1) XML bvw (UTF-8) V{ U+2211(cu wqj) → 0x003F(“?”) → 0x003F(“?”) 60 pureXML 8O Z 5 B i/ XML }] I(}=Vwi/oT(%@9C?VoTr,19C=VoT)i/rlwf"Z }]bPD XML }]# *za)KBP!n: v v XQuery mo= v wC SQL odD XQuery mo= v v SQL od v 4P XQuery mo=D SQL od b)=(JmzS SQL r XQuery OBDPi/rlw XML Md{X5}]# IT9Cb)=(i/Mlw XML D5,Nr{v XML D5#i/IT5X,Nr {v XML D5,"RI9C=J^FSi/CJDa{#r*T XML }]Di/5 X XML rP,yT2IT9C XML }]9lDi/a{# XQuery ri XQuery Gr,x*K(W3C)hFD;V/}`LoT,CZzci/M^D XML } ]DX(hs# kI$bD"_P#fa9DX5}];,,XML }]IdT\_#XML }](#G ;I$b"!hMThvD# IZ XML }]Da9;I$b,yTh*T XML }]4PDi/(#kdMDX5 i/;,#XQuery oTa)K4Pb)`MYwyhDinT#}g,I\h*9C XQuery oT4PBPYw: v QwcNa9P3)4*cTsD XML }]# v T}]4Pa9d;(}g,zI\k9*cNa9)# v 5X_PlO`MDa{# v |BVP XML }]# XQuery i/DiI?V Z XQuery P,mo=Gi/Dw*9(i#mo=ITxP6W,C4iIi/Dw e#i/9ITZKwe0f_PrT#rT|,;5PCZ(ei/&m73Dy w#i/we|,CZ(ei/a{Dmo=#Kmo=II9CKc{rX|Vi OxID`v XQuery mo=9I# Z 62 3D< 4 5wKdMi/Da9#ZK>}P,rT|,=vyw:;vGf> yw,|8(*C4&mi/D XQuery o(Df>;m;vG1!{FUdyw,| 8(*CZ^0:*X{FM`M{D{FUd URI#i/we|,;vCZ9l price_list *XDmo=#price_list *XDZ]G+ product *X4[q5rEP qCDPm# © Copyright IBM Corp. 2006, 2013 61 9C XQuery /}lw DB2 }] Z XQuery P,i/ITwCBP/}.;4q! DB2 }]bPDdk XML }]: db2-fn:sqlquery M db2-fn:xmlcolumn# db2-fn:xmlcolumn /}+lw{v XML P,x db2-fn:sqlquery +lwyZ SQL + i/D XML 5# db2-fn:xmlcolumn db2-fn:xmlcolumn /}IC;vV{.DVTd?,CZj6;vmrS}P,i/9C db2-fn:xmlcolumn /}4q! BUSINESS.ORDERS m D PURCHASE_ORDER PPDyPI:)%#;s,i/+TKdk}]4 PYw,Sb)I:)%D;uX7Pi!GP#i/a{G;6)%DyP GPDPm# db2-fn:xmlcolumn(’BUSINESS.ORDERS.PURCHASE_ORDER’)/shipping_address/city db2-fn:sqlquery db2-fn:sqlquery /}IC;vm>+i/DV{.Td?,"5X;vI+i/ 5XD XML 5"CxID XML rP#+i/Xk8(%Pa{/,xRP D}]`MXk* XML#(}8(+i/,+Jmz9C SQL D&\4r XQuery a) XML }]#C/}'V9CN}r SQL od+]5# ZTB>}P,BUSINESS.ORDERS mP|,{* PURCHASE_ORDER D XML P#ZC>}P,i/9C db2-fn:sqlquery /}4wC SQL,Tq!; uUZ* 2005 j 6 B 15 UDyPI:)%#;s,i/+TKdk}]4 PYw,Sb)I:)%D;uX7Pi!GP#i/a{GZ 6 B 15 U; 6)%DyPGPDPm# xquery version "1.0"; declare default element namespace "http://posample.org"; {for $prod in db2-fn:xmlcolumn("PRODUCT.DESCRIPTION")/product/description order by xs:decimal($prod/price) descending return {$prod/name, $prod/price}} Prolog Query body < 4. XQuery PDdMi/Da9 62 pureXML 8O db2-fn:sqlquery(" SELECT purchase_order FROM business.orders WHERE ship_date = ’2005-06-15’ ")/shipping_address/city *c:I db2-fn:sqlquery r db2-fn:xmlcolumn /}5XD XML rPIT|,NN XML 5(|(-S5MZc)#b)/}";a\G5Xq=}PD BUSINESS.ORDERS M PURCHASE_ORDER#Z SQL odP,IT9C!4{F4}Cb)P(} g,business.orders M purchase_order),Z&m SQL od1b){FaT/ *;*s4#(Z SQL P,9IT(}+{FC+}E}p44(F*(gj 6DxVs!4D{F)# XQuery G;VxVs!4DoT XQuery ;a+!4{F*;*s4{F#bVnpaZ,19C XQuery M SQL 1}P,m{ business.orders T0P{ purchase_order M ship_date HITs4N=2IT!4N=vV#+G,db2-fn:xmlcolumn DYw};G SQL i/#Yw}GxVs!4D"CZm>P{D XQuery V{.DV#r *5JP{G BUSINESS.ORDERS.PURCHASE_ORDER,yTZ db2- fn:xmlcolumn DYw}PXkCs48(K{F# 9C SQL i/ XML }]ri IT9C SQL +i/r XMLQUERY M XMLTABLE D SQL/XML i//}4i/ XML }]#9ITZkT XML }]D SQL i/P9C XMLEXISTS =J# v9C SQL(;9CNN XQuery)i/ XML }]1,;\(}"v+i/ZP6p xPi/#*K,;\Si/5X{v XML D5;v9C SQL ;I\5XD5,N# *Z XML D5Zi/,h*9C XQuery#IT9CBPNN SQL/XML /}r=J (} SQL wC XQuery: XMLQUERY 5X XQuery mo=Da{w* XML rPD SQL j?/}# XMLTABLE 5X XQuery mo=Da{w*mD SQL m/}# XMLEXISTS 7( XQuery mo=Gq5XGUrPD SQL =J# Z 5 B i/ XML }] 63 XQuery k SQL DHO DB2 'V+q=}Z9C XQuery,rK DB2 ~qwXk9CJCZ XQuery oTRxVs!4Dfr# ms&mGy]C4&m XQuery mo=DSZ4xPD#(f XQuery ms 1aa) SQLCODE M SQLSTATE,k(f SQL msD==`,#&m XQuery mo=1;a5X/f#XQuery (}wCS DB2 mMSQw+Xkk SQL dO9C v SQL v9C SQL(;9CNN XQuery)lw XML }]1,;\Z XML P6pxPi /#*K,;\Si/5X{v XML D5#KC(ZBPivBJC: v h*lw{v XML D5 v ;h*y]f"D5ZD5xPi/,r_i/D=JZmDd{G XML PP 4P XQuery mo=D SQL/XML /} SQL/XML /} XMLQUERY M XMLTABLE T0 XMLEXISTS =J9 XQuery m o=\;Z SQL OBDP4P#ZBPivB,JOZ SQL Z4P XQuery: v h*tCVP SQL &CLrTZ XML D5Zi/#*Z XML D5Zi/,h* 4P XQuery mo=,bI(}9C SQL/XML 4jI v i/ XML }]D&CLrh*+N}jG+]A XQuery mo=#(N}jGWH s(A XMLQUERY r XMLTABLE PD XQuery d?#) v k XQuery `H,i/"pK|l$ SQL v h*Z%Ni/P5XX5}]M XML }] v h*,S XML MX5}] v h*Vir[/ XML }]#IT+Si/D GROUP BY r ORDER BY Sd& CZ XML }](}g,9C XMLTABLE /}Tmq=lwMU/ XML }]. s) 8( XML {FUd Z XML D5P,XML {FUdGI!D,Cw XML D5PZc{D0:#*CJ 9C{FUdD XML D5PDZc,XQuery mo=Xk,18(,;{FUdw* Zc{D;?V# ITD58(1! XML {FUd,"RITD5PDX(*X8( XML {FUd# Z 5 B i/ XML }] 65 "b,{FUdywCVE(;)ax#bb6E,g{9k9C|,VED SQL od M XQuery mo=,G4;\9CVEw*odU9V{(}g,(}9C db2 -t w C|nP&mw)#9I9C -td !n8(VETbDU9V{,bIT7#;am sXbM|,{FUdywDod#LLPD>}9C&/t(~)w*U9V{ (-td~),+2##9C %(-td%)# }g,pureXML DLL9CT XML D58(K1!*X{FUdD XML D5#T B XML GLLP9CDdP;v XML D5: Jim Noodle 25 EastCreek Markham Ontario N9C 3T6 905-555-7258 XML D5DyZc+D5D1!*X{FUds(A(CJ4j6(URI)http:// posample.org# (}|( declare default element namespace rT,zZLLPKPD XQuery m o=9a+ URI w*1!*X{FUds(#}g,TB SELECT odPD XQuery mo=yw1!*X{FUd;g{TLLP4(D CUSTOMER mKP SELECT o d,G4a5XM'j6: SELECT cid FROM customer WHERE XMLEXISTS(’declare default element namespace "http://posample.org"; $i/customerinfo/addr/city[ . = "Markham"]’ passing INFO as "i") (}Z XML D5P9C,; URI w*1!*X{FUd,Cmo=I9C}7D{ FUd0:Zmo=P^(Zc{#g{;P1!*X{FUdyw,r_+m; URI s(*1!*X{FUd,G4mo=;a9C}7D{FUd^(Zc{,"R; a5XNN}]#}g,TB SELECT od`FZO;od,+|;P1!{FUdy w#g{TLLP4(D CUSTOMER mKPKod,G4;a5XNN}]# SELECT cid FROM customer WHERE XMLEXISTS(’$i/customerinfo/addr/city[ . = "Markham"]’ passing INFO as "i") +{FUd0:kZc{dO9C *9C{FUd^(Zc{,IT?vZc{mS{FUd0:#9C0Et*0: kZc{#TZZc po:addr,{FUd0: po k>XZc{ addr t*#g{9C Zc{4^({FUd0:,G4Xk7#C0:s(A URI#}g,TB SELECT o dPD XQuery mo=(}yw{FUd po +{FUd0: po s(A URI http:// posample.org#TLLP4(D CUSTOMER mKPTBod1,a5X;va{# SELECT cid FROM customer WHERE XMLEXISTS(’ declare namespace po = "http://posample.org"; $i/po:customerinfo/po:addr/po:city[ . = "Markham"]’ passing INFO as "i") {FUd0: po I\GNN0:;X*DGs(A0:D URI#}g,TB SELECT odPD XQuery mo=9C{FUd0: mytest,+`1ZO;odPDmo=: 66 pureXML 8O SELECT cid FROM customer WHERE XMLEXISTS(’declare namespace mytest = "http://posample.org"; $i/mytest:customerinfo/mytest:addr/mytest:city[ . = "Markham"]’ passing INFO as "i") 9C(d{w*{FUd0: IZ XQuery mo=P9C(d{4%d XML }]P9CDNN{FUd#TB SELECT odPD XQuery mo=9C(d{4%dyP{FUd0:# SELECT cid FROM customer WHERE XMLEXISTS(’$i/*:customerinfo/*:addr/*:city[ . = "Markham"]’ passing INFO as "i") TLLP4(D CUSTOMER mKP SELECT od1,a5X;vM'j6# >}:|D*XD{FUd0: b)>}5wKgNmSM}%**XD QName 8(D{FUds(# *XD QName GI!{FUd0:MV?{#{FUd0:kV?{C0Et*#g {{FUd0:fZ,G4as(A URI((CJ4j6),"Raa) URI DrL N=#)9 QName |({FUd URI MV?{# (}9Cng fn:QName"fn:local-name M fn:namespace-uri H/},ITX|{tT MZc{T0iRkZcD{FUd0:`X*D URI# XQuery {FUdywTVE(;)a2,+;\9CVEw*odDU9V{#b)> }9C&/t(~)w*U9V{,k pureXML LLP9CDU9V{`,# T*XmS{FUd0: b)>}9CmPD;v XML D5#BPod+4(Km"+ XML D5ekKm P: CREATE TABLE XMLTEST (ID BIGINT NOT NULL PRIMARY KEY, XMLDOC XML ) ~ INSERT INTO XMLTEST Values (4, ’ ’) ~ TB SELECT odPD XQuery mo=+r*XmS{FUd0:#XQuery mo= 9C fn:QName 44(;v_P{FUds(D QName# XQuery let Sd+4(;v{F* emp "R{FUd* http://example.com/new D U*X#Z transform mo=P,rename mo=+|D XPath mo= $newdept/ depts/dept/emp[@type="new"] yj6D*XD{F#K*XD{F* emp,+G;P {FUd0:# SELECT XMLQUERY ( ’ let $newemp := fn:QName( "http://mycompany.com", "new:emp") return Z 5 B i/ XML }] 67 transform copy $newdept := $doc modify do rename $newdept/depts/dept/emp[@type="new"] as $newemp return $newdept ’ passing XMLDOC as "doc" ) from XMLTEST where ID=4~ XQuery mo=+5XTB XML }]T08(* new:emp ZcD;?VD{FUds (#-}^DDD5G;vP' XML,||,Qs(A{FUdD{FUd0:#Q+ {FUdywmSAQX|{DB*X# S*XP}%{FUd0: IT(}+ZcX|{*;_P{FUds(D QName,45VSZc{P}%{FU d0:#SELECT odPDTB XQuery mo=9C;v for SdM fn:namespace-uri / } 4 7 ( ? v emp Z c P * X Z cD URI# g { URI * http:// oldcompany.com,G4 rename mo=+9C fn:QName M fn:local-name /}S*X ZcP}%{FUd0:# SELECT XMLQUERY ( ’ transform copy $newdept := $x modify for $testemp in $newdept/depts/dept/*:emp/* return if ( fn:namespace-uri( $testemp ) eq "http://oldcompany.com") then do rename $testemp as fn:QName( "", fn:local-name($testemp) ) else() return $newdept ’ passing XMLDOC as "x" ) from XMLTEST where ID=4~ XQuery mo=+5XTB XML }]#Zc{ new:location ;f;* location#4 SZcP}%{FUds(# 68 pureXML 8O XMLQUERY /}Ev 9C XMLQUERY SQL j?/}TZ SQL OBDP4P XQuery mo=#IT+d ?+]AZ XMLQUERY P8(D XQuery mo=#XMLQUERY 5X XML 5,| G XML rP#KrPIT*U,2IT|,;nr`n# (}Z SQL OBDP4P XQuery mo=,ITjIBPNq: v Tf"D?V XML D5x;G{v XML D5xPYw(;P XQuery ITZ XML D5Zi/;v SQL 1Z{vD56pi/) v 9 XML }]\;Nk SQL i/ v ,1TX5}]M XML }]xPYw v +x;=D SQL &m&CZ5XD XML 5(}g,9CSi/D ORDER BY S dTa{xPEr) PX|`j8E",kNDPXHOi/=(DD5# k"b,XQuery xVs!4,rK8(Z XMLQUERY P8(D XQuery mo=M d?1Xk!D# ;h*+] SQL mo=Dj{&\1,9a)KCZ+]P{x;XZ passing Sd PT=8({FDOr%o(#kND9C XMLEXISTS"XMLQUERY M XMLTABLE xPr%P{+]# XMLQUERY 5XDGUrP g{dP8(D XQuery mo=zzGUrP,G4 XMLQUERY /}5XGUrP# }g,g{BP=v XML D5f"Z CUSTOMER mD XML P INFO P: Jim Noodle 25 EastCreek Markham Ontario N9C 3T6 905-555-7258 Robert Shoemaker 1596 Baseline Aurora Ontario N8X 7F8 905-555-7258 416-555-2937 905-555-8743 613-555-3278 g{"vTBi/: SELECT XMLQUERY (’$d/customerinfo/phone’ passing INFO as "d") FROM CUSTOMER Z 5 B i/ XML }] 69 a{/+|,gB=P(QTCdvxPq=`ETc|Se~wK): 1 ----------- 905-555-7258 905-555-7258416-555-2937905-555-8743613- 555-3278 2 record(s) selected. k"b,Z;P|,;v *XDrP,xZ~P|,Dv *XDr P#zIKa{Gr*Z~v XML D5|,Dv *X,"R XMLQUERY 5Xzc XQuery mo=DyP*XDrP#(k"b,Z~PPDa{Ga9;1D D5#k7#SUKa{DNN&CLr<\}7&mKP*#) O;v>}5wK(#9C XMLQUERY D==:;N&CZ;v XML D5,dP zIDmD?Pm>;vD5zzDa{#+G,9IT+ XMLQUERY ,1&CZ` vD5,Mq`vD5|,Z%vrPP;y#ZK>}P,+ XMLQUERY &CZr PPDyPD5zzDa{5XZ;PP# }g,Y(OfT>DGvD5f"Z CUSTOMER mD INFO PP#TBi/PD db2-fn:xmlcolumn /}5X;vZ INFO PP|,=v XML D5DrP# VALUES (XMLQUERY (’db2-fn:xmlcolumn("CUSTOMER.INFO")/customerinfo/phone’)) ;s,+ XMLQUERY &CZ XML D5Db;vrP,"Ra{/v|,;P,g By>: 1 ----------- 905-555-7258905-555-7258416-555-2937905-555- 8743613-555-3278 1 record(s) selected. INFO PP XML D5PDyP *X<5XZ;PP,r* XMLQUERY T %v5xPYw:S db2-fn:xmlcolumn 5XD XML D5DrP# XMLQUERY 5XDUrP g{dP8(D XQuery mo=5XUrP,G4 XMLQUERY /}5XUrP# }g,ZTBi/P,TZ CUSTOMER mD INFO PP;|,5*“Aurora”D *XD?;P,XMLQUERY +5XUrP# SELECT Cid, XMLQUERY (’$d//addr[city="Aurora"]’ passing INFO as "d") AS ADDRESS FROM CUSTOMER Y( CUSTOMER mP}P,+;P;v XML D5|,5*“Aurora”D *X# O;v SELECT od+zzBm(QTCdvxPq=`ETc|Se~wK)# 70 pureXML 8O m 7. a{m CID ADDRESS 1001 1002 1003 1596 BaselineAuroraOntarioN8X-7F8 k"bGgNT;|,5*“Aurora”D *XDP5X$H*cDQrP/ XML, x;GU5DUrP#+G,+ZZ}PP5X *X,r*|zc XQuery m o=#ZZ}PP,+5X;vGUrP# (}ZodD WHERE Sdx;G SELECT SdP&C=J(g XMLEXISTS),I T\b5X|,UrPDP#}g,IT4gBy>`4O;vi/,+ XMLQUERY /}PD}K=JF/= WHERE Sd: SELECT Cid, XMLQUERY (’$d/customerinfo/addr’ passing c.INFO as "d") FROM Customer as c WHERE XMLEXISTS (’$d//addr[city="Aurora"]’ passing c.INFO as "d") (}Ki/zIDmgBy>: m 8. a{m CID ADDRESS 1003 1596 BaselineAuroraOntarioN8X-7F8 XMLQUERY (#CZ SELECT SdPT5Xy!D5D,N#Z XMLQUERY D XQuery mo=P8(D=J;}Ka{/PDP,|GvCZ7(5XD,N#*f} }%a{/PDP,h*Z WHERE SdP&C=J#XMLEXISTS =JIC4&C @5Zf"D XML D5ZD5D=J# + XMLQUERY a{D?F`M*;*G XML `M *+ XMLQUERY /}Da{5XA SQL OBDTxPx;=&m(gxPHOrE rYw),G4+5XD XML 5?F*;*f]D SQL `M#IT9C XMLCAST f6TZ XML 5MG XML 5.dxP?F`M*;# ": 1. v1Z XMLQUERY P8(D XQuery mo=5XDrP|,;vQr"Dn1, E\+ XMLQUERY Da{*;* SQL }]`M# 2. ZG UTF-8 }]bP,+ XMLQUERY Da{*;* SQL }]`Ma}:HOi/PD XML 5MG XML 5 ZTBi/P,+ XMLQUERY 5XDrPSd XML `M*;*V{`M,TcI T+|k PRODUCT mD NAME PHO#(g{S XMLQUERY 5XD XML 5 ;GrP/DV{.,G4 XMLCAST Yw+'\#) SELECT R.Pid FROM PURCHASEORDER P, PRODUCT R WHERE R.NAME = XMLCAST( XMLQUERY (’$d/PurchaseOrder/item/name’ PASSING P.PORDER AS "d") AS VARCHAR(128)) >}:4 XMLQUERY a{xPEr ZTBi/P,4z7hvD *XD5ErD3r5Xz7j6,Cz7hv w* XML D5f"#r* SQL ;\T XML 5xPEr,yTXk+rP*;* SQL ITdxPErD5(ZK>}P,*V{)# SELECT Pid FROM PRODUCT ORDER BY XMLCAST(XMLQUERY (’$d/product/description/name’ PASSING DESCRIPTION AS "d") AS VARCHAR(128)) }]`M.dD?F*; Zm`ivB,h*+_Px(}]`MD5?F`M*;*m;V}]`M,r_ *;*$H"+Hr!};;,D,;}]`M# }]`Ma}G;v>},+;V}]`Ma}*m;V}]`M1h*+5?F* ;*BD}]`M#I?F*;*m;V}]`MD;V}]`MIS4}]`M? F`M*;*?j}]`M# IT+;V}]`M~=rT=X?F*;*m;V}]`M#y]f0=D}]` M,IT9C?F`M*;/}"CAST f6r XMLCAST f64T=|D}]`M# mb,14(KC'(eDP4/}1,Xk\;+4/}DN}D}]`M?F* ;*}Z4(D/}D}]`M# Z 74 3Dm 9 PT>KZC}]`M.d\'VD?F`M*;#Z;Pm>?F` M*;Yw}D}]`M(4}]`M),xjbPD}]`Mm>?F`M*;Y wD?j}]`M#“Y”m>IT+ CAST f6CZ4}]`MM?j}]`MDi O#5wK;\9C XMLCAST f6DG)iv# g{+NN}]`M?F*;*V{r}]`M S v S}C`M RT Dm>}]`M S ?F*;*}C`M RT v S?j`M* T D}C`M RT ?F*;*?j`M* S D}C`M RS,dP S G T D,`M# v S}]`M A ?F*;*}C`M RT,dP,I+ A a}*}C`M RT Dm> }]`M S# Z 5 B i/ XML }] 73 149C#={4T?F`M*;Pf0=DN<}]`MD?j`MST^(1, 9C SQL 764iR|(CC'(eD}]`MD_PC{FDZ;V#=# m 9. \'VDZC}]`M.dD?F`M*; 4}]`M ?j}]`M S M A L L I N T I N T E G E R B I G I N T D E C I M A L R E A L D O U B L E D E C F L O A T C H A R C H A R F B D2 V A R C H A R V A R C H A R F B D2 C L O B G R A P H I C V A R G R A P H I C D B C L O B B L O B D A T E T I M E T I M E S T A M P X M L B O O L E A N SMALLINT YYYYYYYYYYY -Y1 Y1 -----Y3 Y7 INTEGER YYYYYYYYYYY -Y1 Y1 -----Y3 Y7 BIGINT YYYYYYYYYYY -Y1 Y1 -----Y3 Y7 DECIMAL YYYYYYYYYYY -Y1 Y1 -----Y3 - REAL YYYYYYYYYYY -Y1 Y1 -----Y3 - DOUBLE YYYYYYYYYYY -Y1 Y1 -----Y3 - DECFLOAT YYYYYYYYYYY -Y1 Y1 ------- CHAR YYYYYYYYYYYYY1 Y1 Y1 YYYYY4 - CHAR FOR BIT DATA YYYYYYYYYYY - - - - YYYYY3 - VARCHAR YYYYYYYYYYYYY1 Y1 Y1 YYYYY4 - VARCHAR FOR BIT DATA YYYYYYYYYYY - - - - YYYYY3 - CLOB -------Y-Y-YY1 Y1 Y1 Y- - -Y4 - GRAPHIC Y1 Y1 Y1 Y1 Y1 Y1 Y1 Y1 -Y1 -Y1 YYYYY1 Y1 Y1 Y3 - VARGRAPHIC Y1 Y1 Y1 Y1 Y1 Y1 Y1 Y1 -Y1 -Y1 YYYYY1 Y1 Y1 Y3 - DBCLOB -------Y1 -Y1 -Y1 YYYY - - -Y3 - BLOB --------Y-Y----Y---Y4 - DATE - Y Y Y - - - YYYY -Y1 Y1 --Y-YY3 - TIME - Y Y Y - - - YYYY -Y1 Y1 ---Y-Y3 - TIMESTAMP - - Y Y - - - YYYY -Y1 Y1 --YYYY3 - XML Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y5 Y- BOOLEAN Y7 Y7 Y7 -----------------Y7 74 pureXML 8O m 9. \'VDZC}]`M.dD?F`M*; (x) 4}]`M ?j}]`M S M A L L I N T I N T E G E R B I G I N T D E C I M A L R E A L D O U B L E D E C F L O A T C H A R C H A R F B D2 V A R C H A R V A R C H A R F B D2 C L O B G R A P H I C V A R G R A P H I C D B C L O B B L O B D A T E T I M E T I M E S T A M P X M L B O O L E A N 5w v PXf0=C'(eD`MM}C`MD\'VD?F`M*;DE",kNDCm0fDhv# v ^(+a9/`M5?F*;*d{NN`M5# v LONG VARCHAR M LONG VARGRAPHIC }]`MLx\'V+G;Fv9C,"RZ+4D"PfPI\a}%# 1 v'VT Unicode }]bxP?F`M*;# 2 FOR BIT DATA 3 ;\9C XMLCAST 44P?F`M*;# 4 ~=&m XMLPARSE /},TcZT XML PD35(INSERT r UPDATE)*V{.1+V{.*;* XML#V {.XkGa9KZ?F*;*j6D?j}]`M1&ZDoiRPXyJCDfrDE "# m 10. PX?F*;*3V}]`MDfr ?j}]`M fr SMALLINT g{4`MG BOOLEAN,G4+ TRUE ?F `M*;* 1 "+ FALSE ?F`M*;* 0#PXyPd{4`M,kND #6SQL Reference Volume 1 7PD:SMALLINT j? /}; INTEGER g{4`MG BOOLEAN,G4+ TRUE ?F `M*;* 1 "+ FALSE ?F`M*;* 0#PXyPd{4`M,kND #6SQL Ref- erence Volume 17PD:INTEGER j?/}; Z 5 B i/ XML }] 75 m 10. PX?F*;*3V}]`MDfr (x) ?j}]`M fr BIGINT g{4`MG BOOLEAN,G4+ TRUE ?F `M*;* 1 "+ FALSE ?F`M*;* 0#PXyPd{4`M,kND #6SQL Ref- erence Volume 17PD:BIGINT j?/}; DECIMAL 6SQL Reference Volume 17PD:DECIMAL j?/}; NUMERIC 6SQL Reference Volume 17PD:DECIMAL j?/}; REAL 6SQL Reference Volume 1 7PD:REAL j ?/}; DOUBLE 6SQL Reference Volume 17PD:DOUBLE j ?/}; DECFLOAT 6SQL Reference Volume 17PD:DECFLOAT j?/}; CHAR 6SQL Reference Volume 1 7PD:CHAR j ?/}; VARCHAR 6SQL Reference Volume 1 7PD:VARCHAR j?/}; CLOB 6SQL Reference Volume 1 7PD:CLOB j ?/}; GRAPHIC 6SQL Reference Volume 1 7PD:GRAPHIC j?/}; VARGRAPHIC 6 SQL Reference Volume 1 7 P D :VARGRAPHIC j?/}; DBCLOB 6SQL Reference Volume 1 7PD:DBCLOB j?/}; BLOB 6SQL Reference Volume 1 7PD:BLOB j ?/}; DATE 6SQL Reference Volume 1 7PD:DATE j ?/}; TIME 6SQL Reference Volume 1 7PD:TIME j ?/}; TIMESTAMP g{4`M*V{.,kND 6SQL Refer- ence Volume 1 7PD:TIMESTAMP j?/ };,dP8(K;vYw}#g{4}]` M* DATE,G41dAGI8(DUZM1 d 00:00:00 iI# BOOLEAN g{4`M* numeric,G4+ 0 ?F`M* ;* FALSE "+ 1 ?F`M*;* TRUE# + NULL ?F`M*;* NULL# 76 pureXML 8O +G XML 5?F*;* XML 5 m 11. \'VDSG XML 5?F*;* XML 5 4}]`M ?j}]`M XML qCD XML #=`M SMALLINT Y xs:short INTEGER Y xs:int BIGINT Y xs:long DECIMAL r NUMERIC Y xs:decimal REAL Y xs:float DOUBLE Y xs:double DECFLOAT N - CHAR Y xs:string VARCHAR Y xs:string CLOB Y xs:string GRAPHIC Y xs:string VARGRAPHIC Y xs:string DBCLOB Y xs:string DATE Y xs:date TIME Y xs:time TIMESTAMP Y xs:dateTime1 BLOB Y xs:base64Binary V{`M FOR BIT DATA Y xs:base64Binary %5`M +KK(}bV*;qCD XQuery `M# m 12. \'VDS XML 5?F*;*G XML 5 ?j}]`M 4}]`M XML `&D XQuery ?j`M SMALLINT Y xs:short INTEGER Y xs:int BIGINT Y xs:long DECIMAL r NUMERIC Y xs:decimal REAL Y xs:float DOUBLE Y xs:double DECFLOAT Y ;P%d`M1 CHAR Y xs:string VARCHAR Y xs:string CLOB Y xs:string GRAPHIC Y xs:string VARGRAPHIC Y xs:string DBCLOB Y xs:string DATE Y xs:date TIME(;x1x) Y xs:time TIMESTAMP(;x1x) Y xs:dateTime2 BLOB Y xs:base64Binary CHAR FOR BIT DATA N ;I4P?F`M*; VARCHAR FOR BIT DATA Y xs:base64Binary %5`M +K}+?D`VZV{#rK,Z3)ivB,XOIzzMZ$ZDOL V{.#}g,V{ ñ Z UTF-8 Pm> 2 VZD“C3 B1”#+KV{D`M?F *;I VARCHAR(1) 1,+“C3 B1”XO* 1 vVZ+tB;j{DV{“C3”#K ;j{DV{“C3”2a;}%,rKnUDa{GI*UV{.# v **;* DECIMAL 5D XML 5;(;C,}!}c0fD(+H - !};}) }V;+XO!}cs,}!};}D}`}V#IzD XML #=`MD{FG DECIMAL_precision_scale,dP precision G?j SQL }]`MD+H,x scale G?j SQL }]`MD!};;}g,g{ XMLCAST ?j}]`M* DECIMAL (9,2),G4IzD XML #=`MD{F* DECIMAL_9_2# v **;* TIME 5D XML 5;\Z!}csf|,_PGc;}Dk?V#Iz D XML #=`MD{F* TIME# g{ XML 5;zcNNb)^F,G4IzD XML #=`M{+;vVZ{"P# K`M{IozC'Kbms{",+G;T&ZQ(eDNN XQuery `M#g{d k5;{OIzD XML #=`M(`&D XQuery ?j`M)Dy>`M,G4ms {"I\a8>C`M#IZKIz XML #=`M{Dq=+4I\a|D,rK; &+|Cw`LSZ# Z XQuery ?F`M*;&m XML 5.0,+}%rPPDNND5Zc,x;}% DD5ZcD?v1SSz+I*CrPPD;n#g{D5Zc_P`v1SSz Zc,G4^D.sDrPH-# xquery-argument 8(++]A xquery-expression-constant y8(D XQuery mo=DN}#N }8(5M+]C5D==#CN}|(+xPs5D SQL mo=# v g{zI5D`MG XML,G4|+dI input-xml-value#U XML 5+* ;* XML UrP# v g{zI5D`M;G XML,G4|XkI?F*;* XML }]`M#U 5+*;* XML UrP#*;sD5+dI input-xml-value# T xquery-expression-constant xPs51,+* XQuery d?a);vHZ input-xml-value D5MI AS Sd8(D{F# xquery-variable-expression 8(;v SQL mo=,d5Z4PZdI) xquery-expression-constant y 8(D XQuery mo=9C#Cmo=;\|,rP}C (SQLSTATE 428F9) r OLAP /} (SQLSTATE 42903)#Cmo=D}]`M;\G DECFLOAT# AS identifier 8( xquery-variable-expression yzID5+w* XQuery d?+]A xquery-expression-constant#Cd?{+* identifier#XQuery oTPDd? {0fD0<@*{E ($) ;|(Z identifier P#j6XkGP'D XQuery d?{,"R^Z XML NCName (SQLSTATE 42634)#j6D$ H;\,} 128 vVZ#,; PASSING SdPD=vN};\9C`, Dj6 (SQLSTATE 42711)# BY REF 8>+(}}C+] XML dk5#1(}}C+] XML 51,XQuery s5+1SS8(Ddkmo=P9CdkZcw(g{P),b+#t yPtT,|(-# RETURNING SEQUENCE 8> XMLQUERY mo=5X;vrP# BY REF 8>(}}C5X XQuery mo=Da{#g{K5|,Zc,G49C XQuery mo=D5X5DNNmo=+1SSUZc}C,b+#tyPZctT,|( Z 5 B i/ XML }] 81 -}) v T XML D5PD5xPEr }g,ZTBi/P,4f"Z CUSTOMER mD INFO PPD XML D5ZDM '{Ta{xPEr# SELECT X.* FROM XMLTABLE (’db2-fn:xmlcolumn("CUSTOMER.INFO")/customerinfo’ COLUMNS "CUSTNAME" CHAR(30) PATH ’name’, "PHONENUM" XML PATH ’phone’) as X ORDER BY X.CUSTNAME v +;) XML 5f"*X5}],"+;) XML 5f"* XML(kNDPXek 5D XMLTABLE >}) X*Bn:g{Z XMLTABLE D PATH !nP8(D XQuery mo=5X: v `vniIDrP,G4PD}]`MXk* XML#g{}Z+S XMLTABLE 5 XD5ek= XML PP,G47#ekD5Gq=},kNDPXek5D XMLTABLE >}# v UrP,G4TCP55XU5# >}:ek XMLTABLE P5XD5 XMLTABLE SQL m/}ICZSf"D XML D5Plw5,;s+lw=D5ek =mP# Z 5 B i/ XML }] 83 K=(Gr%N=DVb,VbG+ XML D5,Nf"ZX5mPPD}L#(fx "MD XML #=Vb&\a)DG|UiD;VVb`M#hzx"MD XML #= Vb,IT,1+`v XML D5VbI`vm#) }g,g{BP=v XML D5f"Z{* CUSTOMER DmP: Kathy Smith 25 EastCreek Markham Ontario N9C 3T6 905-555-7258 Robert Shoemaker 1596 Baseline Aurora Ontario N8X 7F8 905-555-7258 416-555-2937 905-555-8743 613-555-3278 "Rzk*+b)D5PD5ek=4gB(eDmP: CREATE TABLE CUSTPHONE (custname char(30), numbers XML) ;s,9C XMLTABLE DTB INSERT odC XML D5PD5nd CUSTPHONE: INSERT INTO CUSTPHONE SELECT X.* FROM XMLTABLE (’db2-fn:xmlcolumn("CUSTOMER.INFO")/customerinfo’ COLUMNS "CUSTNAME" CHAR(30) PATH ’name’, "PHONENUM" XML PATH ’document{{phone}}’ )asX k"b,XQuery Zc9l/}“document{{phone}}”GZ XMLTABLE P PHONENUM PD76mo=P8(D#h*D59l/},r*ek = XML P(ZK>}P* NUMBERS P)PD5XkGq=}P, D5P Cid=″1003″ DyP *X5XZ;v|,D vnDrPP: {905-555-7258,416-555-2937, 905-555-8743, 613-555-3278} KrP>mGa9;1D XML D5,rK;\ek= XML P NUMBERS P#*7 #I&ek phone 5,+rPDyPn9lI;vq= ( Q T C d v x P q = ` E T c | S e ~ w K ): 84 pureXML 8O m 13. a{m CUSTNAME NUMBER Kathy Smith 905-555-7258 Robert Shoemaker 905-555-7258 416-555-2937 905-555-8743 613-555-3278 >}:9C XMLTABLE T3nD?v5}5X;P g{ XML D5|,3v*XD`v5},"Rzk*TK*XD?v5}zI;P, G4IT9C XMLTABLE 4o=K'{# }g,g{BP=v XML D5f"Z{* CUSTOMER DmP: Kathy Smith 25 EastCreek Markham Ontario N9C 3T6 905-555-7258 Robert Shoemaker 1596 Baseline Aurora Ontario N8X 7F8 905-555-7258 416-555-2937 905-555-8743 613-555-3278 *4(;vm,dP?v 59C XMLTABLE: SELECT X.* FROM CUSTOMER C, XMLTABLE (’$cust/customerinfo/phone’ PASSING C.INFO as "cust" COLUMNS "CUSTNAME" CHAR(30) PATH ’../name’, "PHONETYPE" CHAR(30) PATH ’@type’, "PHONENUM" CHAR(15) PATH ’.’ )asX Ki/T=v XML D5zzTBa{: Z 5 B i/ XML }] 85 m 14. a{m CUSTNAME PHONETYPE PHONENUM Kathy Smith work 905-555-7258 Robert Shoemaker work 905-555-7258 Robert Shoemaker home 416-555-2937 Robert Shoemaker cell 905-555-8743 Robert Shoemaker cottage 613-555-3278 k"b{F*“Robert Shoemaker”D XML D5PD?v *XGgNZ%@ PP5XD# TZ`,D5,z2ITi! *Xw* XML,gBy>: SELECT X.* FROM CUSTOMER C, XMLTABLE (’$cust/customerinfo/phone’ PASSING C.INFO as "cust" COLUMNS "CUSTNAME" CHAR(30) PATH ’../name’, "PHONETYPE" CHAR(30) PATH ’@type’, "PHONENUM" XML PATH ’.’ )asX Ki/T=v XML D5zzTBa{(QTCdvxPq=`ETc|Se~w K): m 15. a{m CUSTNAME PHONETYPE PHONENUM Kathy Smith work 416-555-1358 Robert Shoemaker work 905-555-7258 Robert Shoemaker home 416-555-2937 Robert Shoemaker cell 905-555-8743 Robert Shoemaker cottage 613-555-3278 >}:9C XMLTABLE &m XML D5P`vwy|,D*X Z|,`vcNa9rwD XML D5P,;vwPD*XI\km;vwPD*X. dfZX5#IT9C XPath mo=4&m XML D5PD`X*X# TB>}+y] XML D5PDE"4zIPX+h8MR_a(ABsCDm#K XML D5P|,kBsCPwnyZ;C`XDE"# TBod+4(CZf"K XML D5D MOVE m: CREATE TABLE MOVE (ID BIGINT NOT NULL PRIMARY KEY, MOVEINFO XML ) TB XML }]|,PXwv+>5PDwn0d;CDE"#XML E"VI=vw# ;vwP|,PXwnDE",}g,nytD?E"nDjGET0TnDhv# m;vwP|,PXa(YwDE",}g,?Ea(=DB;C"*l+R8(D %c"+2xrT0f"x# TBoda+K XML D5ek MOVE mP: INSERT into MOVE (ID, MOVEINFO) values ( 1, ’ 86 pureXML 8O laser printer common monitor, CRT storage CPU, desktop office monitor, LCD office cabinet, 3 dwr office table, round 1m storage main 1 1 2 east 1 2 2 west 2 1 2 ’) TB SELECT od+n?E"k;CE"iO=;p,"4(m4P>n?E""?E E"MB;C# 3dDX|G9C`T XPath a $x/../../ 9n?E"k;CE"%d# SELECT T.* from MOVE, XMLTABLE( ’$doc/listing/items/item’ PASSING MOVE.MOVEINFO AS "doc" COLUMNS ITEM_ID VARCHAR(10) PATH ’let $x := . return $x/@tag’ , DESC VARCHAR(20) PATH ’let $x := . return $x/name’ , DEPT VARCHAR(15) PATH ’let $x := . return $x/@dept’ , WING VARCHAR(10) PATH ’let $x := . return $x/../../locations/ building[@dept = $x/@dept]/wing’, Z 5 B i/ XML }] 87 FLOOR VARCHAR(10) PATH ’let $x := . return $x/../../locations/ building/floor[@area = $x/area and ../@dept = $x/@dept ]’ )as T Ty>}]KPKod1,+5XTB}]: ITEM_ID DESC DEPT WING FLOOR ---------- -------------------- --------------- ---------- ---------- 12223 printer, laser acct west 1 23665 monitor, CRT recptn main 1 42345 CPU, desktop acct west 2 33301 monitor, LCD recptn main 2 10002 cabinet, 3 dwr mfg east 2 65436 table, round 1m acct west 2 >}:9C XMLTABLE &mVc}] XML D5PIT|,}]DcNa9,xKcNa9|,D6W6p}Id#IT9C XPath mo=4&mVc}]# TB>}+4(I;(FczD?~T0?v?~D8i~iIDPm#E"yZ; v XML D5,KD5P|,FczDi~T0i~.dDX5# TBod+4(CZf"K XML D5D BOMLIST m: CREATE TABLE BOMLIST (Cid BIGINT NOT NULL PRIMARY KEY, ITEMS XML ) XML D5|,i~MSi~DPm#i~PmkCZhvi~DSi~DcNa9` X#g{;vi~I`vSi~iI,G4?vSi~+P>*Ki~D;vS* X# TBoda+K XML D5ek BOMLIST mP: CREATE TABLE BOMLIST (Cid BIGINT NOT NULL PRIMARY KEY, ITEMS XML ) insert into BOMLIST (Cid, ITEMS) values ( 1, ’ 88 pureXML 8O ’) TB SELECT od/@D5"4(mTP>?~M8?~# ;nX*&\G9C XMLTABLE /}4(m B#Z XPath a $doc//part P9C // 4/@“n”ZcPDyP?~*X# SELECT A.ITEMNAME, B.PART, B.PARENT FROM BOMLIST , XMLTABLE(’$doc/item’ PASSING BOMLIST.ITEMS AS "doc" COLUMNS ITEMNAME VARCHAR(20) PATH ’./@desc’, ITEM XML PATH ’.’ )AS A, XMLTABLE(’$doc//part’ PASSING A.ITEM AS "doc" COLUMNS PART VARCHAR(20) PATH ’./@desc’, PARENT VARCHAR(20) PATH ’../@desc’ )AS B T}]KPTBod1,+T>Bm"P>?~M8?~: ITEMNAME PART PARENT -------------------- -------------------- -------------------- computersystem computer computersystem computersystem motherboard computer computersystem CPU motherboard computersystem register CPU computersystem memory motherboard computersystem transistor memory computersystem diskdrive computer computersystem spindlemotor diskdrive computersystem powersupply computer computersystem powercord powersupply computersystem monitor computersystem computersystem cathoderaytube monitor computersystem keyboard computersystem computersystem keycaps keyboard computersystem mouse computersystem computersystem mouseball mouse XMLTABLE XMLTABLE /}5X;va{m,Ca{mGI\9C8(dkTd?w* XQuery d ?T XQuery mo=xPs5Da{#P XQuery mo=Da{rPPD?vrPn< m>a{mPD;P# XMLTABLE ( xmlnamespaces-declaration , row-xquery-expression-constant  , BY REF PASSING row-xquery-argument Z 5 B i/ XML }] 89  , (1) COLUMNS xml-table-regular-column-definition ) xml-table-ordinality-column-definition row-xquery-argument: (2) xquery-variable-expression AS identifier BY REF xml-table-regular-column-definition: column-name data-type BY REF default-clause PATH column-xquery-expression-constant xml-table-ordinality-column-definition: column-name FOR ORDINALITY ": 1 ;\`N8( xml-table-ordinality-column-definition Sd (SQLSTATE 42614)# 2 mo=D}]`M;\G DECFLOAT# #=* SYSIBM#;\+/}{8(*^({# xmlnamespaces-declaration 8(;vr`v XML {FUdyw,b)yw+I* row-xquery-expression- constant M column-xquery-expression-constant D2,OBDD;?V#g{ XQuery mo=G XMLTABLE DN},G4bVmo=D2,Q*{FUd/I$H(" D2,Q*{FUd/MKSdP8(D{FUdywiI#XQuery mo=PD XQuery rTIT2Gb){FUd# g{48( xmlnamespaces-declaration,G4;P$H("D2,Q*{FUd/J CZ XQuery mo=# row-xquery-expression-constant 8(;v SQL V{.#?,9C\'VD XQuery oTo(I+dbM* XQuery mo=#C#?V{.+1S*;* UTF-8,x;*;*}]brZzk3# XQuery mo=9C;iI!Ddk XML 54P,"5X;vdv XQuery rP, RZCrPPT?vrPnzI;P#row-xquery-expression-constant D5;\GU V{.rUWV{. (SQLSTATE 10505)# PASSING 8(dk5T0b)5+]A row-xquery-expression-constant y8(D XQuery m o=D==#1!ivB,(}9CP{w*d?{,+wC/}1yZwCrP 90 pureXML 8O D?v(;P{~=+]A XQuery mo=#g{8(D row-xquery-argument P D identifier kP{wCr`%d,G4a+T= row-xquery-argument +]A XQuery mo=,Sx2GC~=P# BY REF 8(1!ivB(}}C+]NN XML dkN}#1(}}C+] XML 5 1,XQuery s5+1SS8(Ddkmo=P9CdkZcw(g{P),b +#tyPtT,|(-# row-xquery-argument 8(++]A row-xquery-expression-constant y8(D XQuery mo=DN}# N}8(5M+]C5D==#CN}|(Z+a{+]A XQuery mo=. 0xPs5D SQL mo=# v g{zI5D`MG XML,G4|+dI input-xml-value#U XML 5+* ;* XML UrP# v g{zI5D`M;G XML,G4|XkI?F*;* XML }]`M#U 5+*;* XML UrP#*;sD5+dI input-xml-value# T row-xquery-expression-constant xPs51,+* XQuery d?a);vH Z input-xml-value D5MI AS Sd8(D{F# xquery-variable-expression 8(;v SQL mo=,d5Z4PZdI) row-xquery-expression- constant y8(D XQuery mo=9C#Cmo=;\|, NEXT VALUE mo="PREVIOUS VALUE mo= (SQLSTATE 428F9) r OLAP /} (SQLSTATE 42903)#Cmo=D}]`M;\G DECFLOAT# AS identifier 8( xquery-variable-expression yzID5+w* XQuery d?+]A row- xquery-expression-constant#Cd?{+* identifier#XQuery oTPDd? {0fD0<@*{E ($) ;|(Z identifier P#j6XkGP'D XQuery d?{,"R^Z XML NCName#j6D$H;\,} 128 v VZ#,; PASSING SdPD=vN};\9C`,Dj6 (SQLSTATE 42711)# BY REF 8>+(}}C+] XML dk5#1(}}C+] XML 51,XQuery s5+1SS8(Ddkmo=P9CdkZcw(g{P),b+#t yPtT,|(-# COLUMNS 8(a{mDdvP. g{48(KSd,G4+(}}C5X%v4|{D XML Z 5 B i/ XML }] 91 }]`MP,d5yZT row-xquery-expression-constant PD XQuery mo=xP s5zIDrPn(`1Z8( PATH ’.’)#*}Ca{P,XkZC/}sfD correlation-clause P8( column-name# xml-table-regular-column-definition 8(a{mDdvP,|(P{"}]`M"XML +]zFT0CZSm>P DrPnPi!5D XQuery mo=# column-name 8(a{mPDP{#C{F;\;^(,"R;\TmPD`P9C` ,D{F (SQLSTATE 42711)# data-type 8(PD}]`M#kND CREATE TABLE TKbo(MIC`MDh v#g{fZ'VS XML }]`M?F*;*y8(D data-type D XMLCAST,G4ITZ XMLTable P9C data-type# BY REF 8((}}C5X XML }]`MPD XML 5#1!ivB,(}}C 5X XML 5#(}}C5X XML 51,XML 5+1SZa{5P| (dkZcw(g{P)"#tyPtT,|(-# default-clause 8(PD1!5#kND CREATE TABLE TKbo(M default-clause D hv#TZ XMLTABLE a{P,g{&m column-xquery-expression- constant P|,D XQuery mo=15XUrP,G4+&C1!5# PATH column-xquery-expression-constant 8(;v SQL V{.#?,9C\'VD XQuery oTo(I+dbM* XQuery mo=#C#?V{.+1S*;* UTF-8,x;*;*}]br Zzk3#column-xquery-expression-constant 8(;v XQuery mo=,C mo=7(k row-xquery-expression-constant PD XQuery mo=Ds5a {n`XDP5#Y(&m row-xquery-expression-constant zIDa{PD 3nGb?a)DOBDn,r+T column-xquery-expression-constant x Ps5"5XdvrP#4gBy>y]KdvrP7(P5: v g{dvrP;|,NNn,G4 default-clause +a)P5# v g{5XUrP"R48( default-clause,G4+TP8(U5# v g{5XGUrP,G4+9C XMLCAST f6+5?F*;*TP8 (D data-type#Z&mK XMLCAST 1I\a5Xms# column-xquery-expression-constant D5;\GUV{.rUWV{. (SQLSTATE 10505)#g{48(KSd,G41! XQuery mo=v* column-name# xml-table-ordinality-column-definition 8(a{mDr}P# column-name 8(a{mPDP{#C{F;\;^(,"R;\TmPD`P9C` ,D{F (SQLSTATE 42711)# 92 pureXML 8O FOR ORDINALITY 8( column-name Ga{mDr}P#KPD}]`M* BIGINT#a{ mPKPD5GT row-xquery-expression-constant PD XQuery mo=xP s5zIDrPPPnDrPE# g{TNN XQuery mo=xPs51zzms,G4 XMLTABLE /}+5X XQuery ms(SQLSTATE 6p“10”)# >} +)%P4,*“NEW”D)%nP>*ma{# SELECT U."PO ID", U."Part #", U."Product Name", U."Quantity", U."Price", U."Order Date" FROM PURCHASEORDER P, XMLTABLE(’$po/PurchaseOrder/item’ PASSING P.PORDER AS "po" COLUMNS "PO ID" INTEGER PATH ’../@PoNum’, "Part #" CHAR(10) PATH ’partid’, "Product Name" VARCHAR(50) PATH ’name’, "Quantity" INTEGER PATH ’quantity’, "Price" DECIMAL(9,2) PATH ’price’, "Order Date" DATE PATH ’../@OrderDate’ ) AS U WHERE P.STATUS = ’Unshipped’ i/ XML }]1D XMLEXISTS =J XMLEXISTS =J7( XQuery mo=Gq5X;vr`vnDrP#g{ZK=JP 8(D XQuery mo=5XUrP,G4 XMLEXISTS 5X false;qr,5X true# ITZ SELECT odD WHERE SdP9C XMLEXISTS =J#bVC(m>IT 9Cf"D XML D5PD54^F SELECT i/wCZDP/# }g,TB SQL i/5wgN9C XMLEXISTS =J4+5XDP^F*v|, XML D5R *XD5*“Toronto”DG)P#(k"b,XQuery mo=xVs!4, x SQL ;xVs!4#) SELECT Cid FROM CUSTOMER WHERE XMLEXISTS (’$d//addr[city="Toronto"]’ passing INFO as "d") k"b,Z XMLEXISTS D XQuery mo=P+5+]x XQuery d?D==#ZK >}P,XQuery d? $d s(A CUSTOMER mD INFO PPDD5#9a)KC Z+]P{x;XZ passing SdPT=8({FDOr%o(#kNDZ 98 3D:9 C XMLEXISTS"XMLQUERY r XMLTABLE +]Dr%P{;# 7#}78(K XMLEXISTS PD XQuery mo=,Tc5XZ{Da{#}g,Y ( CUSTOMER mD XML INFO PPf"K`vD5,+;P;vD5|,5* 1000 D Cid tT(X8(D76): Kathy Smith 5 Rosewood Toronto Ontario Z 5 B i/ XML }] 93 M6W 1E6 416-555-1358 IZ XQuery mo=PD8"np,BP=vi/5X;,Da{: SELECT * FROM CUSTOMER WHERE XMLEXISTS (’$d/customerinfo[@Cid=1000]’ passing INFO as "d") SELECT * FROM CUSTOMER WHERE XMLEXISTS (’$d/customerinfo/@Cid=1000’ passing INFO as "d") Z;vi/gZ{DGy5X|,OfT>D XML D5DP#+G,Z~vi/5X CUSTOMER mDyPP,-rGTZ8(D XQuery mo=,XMLEXISTS =J\G 5X true#Z~vi/PD XQuery mo=5X<{nDrP(|GGUrP),Sx g{ XMLEXISTS |(_P5=J(expression)D XPath mo=,G4C=(E+C =J(p4,Tc [expression] w*a{#C=(E+5=J(p4I7# expression Ds5a{ky]oeZ{Da{;B# XMLEXISTS =JP* TB!05wKGUrPgNm|(%v5 false 2GgK#;axPw}%d,"Ri/5XDa {/HZ{D*s\`#(}C=(E([])J1X+5=J(p4I\bC Jb# “HO)%|k A512”#Cmo=Da{*5 false r true, b!vZ)%|D5J5#rK,XMLEXISTS /}\G4=_P%vnD5X rP,4,* false r true Dn#r*_P;vnDrPGGUrP,yT XMLEXISTS }GGUrP,dP 3 vrP;|, 1 n: 94 pureXML 8O (42, 3,4,78, 1966) (true) (abd, def) (false) (5) NNbVGUrP<+m5X(false)2GgK# ZZ~vi/P,XMLEXISTS ZDmo=8>“5X|,)%|HZ A512 D )%DM'”#g{D5P;fZbVM',G4a{75+*UrP#Ki /+9Cw},"R+5XZ{Da{# XMLEXISTS =JC> +{v expression EZ=(EP1,d,eL(*“g{{O [expression],G 45X XML }]”,g{ XML }];{O expression,G4&,N # xquery-argument 8(++]A xquery-expression-constant y8(D XQuery mo=DN}#N }8(5M+]C5D==#CN}|(+xPs5D SQL mo=# v g{zI5D`MG XML,G4|+dI input-xml-value#U XML 5+* ;* XML UrP# v g{zI5D`M;G XML,G4|XkI?F*;* XML }]`M#U 5+*;* XML UrP#*;sD5+dI input-xml-value# T xquery-expression-constant xPs51,+* XQuery d?a);vHZ input-xml-value D5MI AS Sd8(D{F# xquery-variable-expression 8(;v SQL mo=,d5Z4PZdI) xquery-expression-constant y 8(D XQuery mo=9C#Cmo=;\|,rP}C (SQLSTATE 428F9) r OLAP /} (SQLSTATE 42903)#Cmo=D}]`M;\G DECFLOAT# AS identifier 8( xquery-variable-expression yzID5+w* XQuery d?+]A xquery-expression-constant#Cd?{+* identifier#XQuery oTPDd? {0fD0<@*{E ($) ;|(Z identifier P#j6XkGP'D XQuery d?{,"R^Z XML NCName#j6D$H;\,} 128 v VZ#,; PASSING SdPD=vN};\9C`,Dj6 (SQLSTATE 42711)# BY REF 8>+(}}C+] XML dk5#1(}}C+] XML 51,XQuery s5+1SS8(Ddkmo=P9CdkZcw(g{P),b+#t yPtT,|(-# "b XMLEXISTS =J;\G: v k JOIN Kc{`X*D ON Sdr MERGE odD;?V (SQLSTATE 42972) v CREATE INDEX EXTENSION odPD GENERATE KEY USING r RANGE THROUGH SdD;?V (SQLSTATE 428E3) v CREATE FUNCTION(b?j?)odPD FILTER USING Sdr CREATE INDEX EXTENSION odPD FILTER USING SdD;?V (SQLSTATE 428E4) v li} SELECT c.cid FROM customer c WHERE XMLEXISTS(’$d/*:customerinfo/*:addr[ *:city = "Aurora" ]’ PASSING info AS "d") Z SQL odk XQuery mo=.d+]N} "vO"D SQL odM XQuery mo=1,IZodkmo=.d+]}]T^Do dMmo=D4P==# +]A XMLEXISTS M XMLQUERY D#?MN}jG XMLEXISTS =JM XMLQUERY j?/}Z SQL odP4P XQuery mo=#9 C#?MN}jG+ SQL odPD}]+]A SQL odP4PD XQuery mo=P Dd?# ITZ XMLEXISTS M XMLQUERY P+ XQuery d?8(* XQuery mo=D; ?V#(} passing Sd+5+]=b)d?P#b)5G SQL mo=#r*+]A XQuery mo=D5GG XML 5,yTXk~=rT=+|G*;* DB2 XQuery ' VD`M#PX\'VD?F`M*;D|`E",kNDPXZ}]`M.d*; DD5# CZ+#?MN}jG+]A XMLQUERY D=(kCZ+]A XMLEXISTS D=( `,,+ XMLEXISTS C(|#{#bGr*Z SELECT SdP9C XMLQUERY P QN}/D=J1,;}%a{/PDNNP#`4,b)=JCZ7(+5XDD 5,N#*f}}%a{/PDP,&Z WHERE SdP9C XMLEXISTS =J#r K,;a5X|,UrPDPw*a{ /D;?V#K&V[D>} 5 w K XMLEXISTS DbV|#{C(# Z 5 B i/ XML }] 97 >}:~=?F`M*; ZTBi/P,Z XMLEXISTS =JP+ SQL V{.#?“Aurora”(|;G XML ` M)~=*;* XML `M#Z~=?F`M*;.s,C#?_P XML #=S`M xs:string,"Rs(Ad? $cityName#;s,ITZ XQuery mo=D=JP9CK# ?# SELECT XMLQUERY (’$d/customerinfo/addr’ passing c.INFO as "d") FROM Customer as c WHERE XMLEXISTS(’$d//addr[city=$cityName]’ passing c.INFO as "d", ’Aurora’ AS "cityName") >}:T=?F`M*; ZTBi/P,r*;\7(N}jGD`M,yTXk+dT=*;*}]`M# T=*;* SQL VARCHAR `MDN}jGfs~=*;* xs:string XML #=`M# SELECT XMLQUERY (’$d/customerinfo/addr’ passing c.INFO as "d") FROM Customer as c WHERE XMLEXISTS(’$d//addr[city=$cityName]’ passing c.INFO as "d", CAST (? AS VARCHAR(128)) AS "cityName") 9C XMLEXISTS"XMLQUERY r XMLTABLE +]Dr%P{ *r/ XMLEXISTS =J"XMLQUERY j?/}r XMLTABLE m/}DC(,I Z XMLEXISTS"XMLQUERY r XMLTABLE 8(D XQuery mo=P+P{Cw N},x;Z passing SdP8({F# g{*9CDN}{;,Z*+]DP{,G4Xk9C passing Sd4+P{w*N }+]# g{ passing SdPT=8(Kd?"R{Fk XQuery mo=}CDNbd?"z e;,G4a+EH(xh passing SdPDd?#Y( CUSTOMER m|,=v XML P: INFO M CUST,TB>}+S INFO PPlw XML }]: SELECT XMLQuery(’$CUST/customerinfo/name’ PASSING INFO as "CUST") FROM customer passing SdP8(Dd? CUST +CZf; XQuery mo=PDP INFO#+;9 C CUSTOMER mPDP CUST# >}:XMLQUERY M XMLEXISTS "b:P{Zb)>}PGxVs!4D,-rG|GGC+}E(p4D#g{4 (Z+}EP,G4#fP{frJC:P{G;xVs!4D,"Rf"*s4N =# TB>}T>tI SELECT od,|G5X PURCHASEORDER mPDD5rP# XML D5ZP PORDER P#0=v SELECT od9C passing Sd+P{ PORDER +]A XMLQUERY j?/}D XQuery mo=#Z}v SELECT + PORDER P {Cw~=+]DN}: SELECT XMLQuery(’$PORDER/PurchaseOrder/item/name’ PASSING porder AS "PORDER") FROM purchaseorder SELECT XMLQuery(’$PORDER/PurchaseOrder/item/name’ PASSING porder AS "porder") FROM purchaseorder SELECT XMLQuery(’$PORDER/PurchaseOrder/item/name’) FROM purchaseorder 98 pureXML 8O TB=v>}T>,19C XMLQUERY M XMLEXISTS DtI/}wC#=v>} }9C passing SdTT===+ INFO P{8(* XMLQUERY j?/}M XMLEXISTS =JPDN}: SELECT XMLQUERY (’$INFO/customerinfo/addr’ passing Customer.INFO as "INFO") FROM Customer WHERE XMLEXISTS(’$INFO//addr[city=$cityName]’ passing Customer.INFO as "INFO", ’Aurora’ AS "cityName") ZTB>}P,XMLQUERY /}49C+]Sd,"R XMLEXISTS passing Sd 48( INFO P#P{ INFO +~=+]A XMLQUERY j?/}M XMLEXISTS = JPD XQuery mo=: SELECT XMLQUERY (’$INFO/customerinfo/addr’) FROM Customer WHERE XMLEXISTS(’$INFO//addr[city=$cityName]’ passing ’Aurora’ AS "cityName") >}:XMLTABLE TB=v>}T>=v9C XMLTABLE m/}D INSERT od#=v>}}9C passing SdTT===+ CUSTLIST P{8(* XMLTABLE m/ }PDN}: INSERT INTO customer SELECT X.* FROM T1, XMLTABLE( ’$custlist/customers/customerinfo’ passing T1.custlist as "custlist" COLUMNS "Cid" BIGINT PATH ’@Cid’, "Info" XML PATH ’document{.}’, "History" XML PATH ’NULL’) as X ZTB>}P,XMLTABLE m/}49C passing Sd#XMLTABLE +m T1 PD P{ CUSTLIST Cw~=+]N}: INSERT INTO customer SELECT X.* FROM T1, XMLTABLE( ’$custlist/customers/customerinfo’ COLUMNS "Cid" BIGINT PATH ’@Cid’, "Info" XML PATH ’document{.}’, "History" XML PATH ’NULL’) as X +N}S XQuery +]A SQL Z XQuery mo=P,db2-fn:sqlquery /}+4Plw XML ZcrPD SQL +i/# 9C db2-fn:sqlquery 1,k9C PARAMETER /}}CS XQuery mo=+]AI db2-fn:sqlquery 8(D SQL fullselect odD}]# (}9C PARAMETER N},I+N}8(* db2-fn:sqlquery P SQL +i/mo= D;?V#g{Z db2-fn:sqlquery wCP9C PARAMETER /},G49Xk8(+ I PARAMETER /}9CD XQuery mo=#Z&m SQL +i/Zd,?v Z 5 B i/ XML }] 99 PARAMETER /}wC+f;* db2-fn:sqlquery /}wCPT& XQuery mo=Da {5#IZ,; SQL odP`N}C PARAMETER /}a)D5# db2-fn:sqlquery /}wCPD XQuery mo=5X;v5#r*+]A+i/D5G XML 5,yT|GXk~=rT=*;* DB2 SQL 'VD`M#PX\'VD?F `M*;D|`E",kND db2-fn:sqlquery D5MPXZ}]`M.d*;DD5# >}:+N}+]A db2-fn:sqlquery TB>}G9C db2-fn:sqlquery D XQuery mo=#Z&m db2-fn:sqlquery /}Zd, T parameter(1) D=N}Ca5X)%UZtT $po/@OrderDate D5# T DB2 SAMPLE }]bKP1,XQuery mo=a5XFcUZZ[vDyP?~D :rj6"?~j6M:r1d# xquery for $po in db2-fn:xmlcolumn(’PURCHASEORDER.PORDER’)/PurchaseOrder, $item in $po/item/partid for $p in db2-fn:sqlquery( "select description from product where promostart < parameter(1) and promoend > parameter(1)", $po/@OrderDate ) where $p//@pid = $item return {data($po/@PoNum)} {data($item)} {data($po/@OrderDate)} 9C XQuery lw}] I(}+ XQuery CwwoT,r_+ SQL CwwoT"9C XMLQUERY SQL / }44P XQuery mo=#9CN;V=(4P XQuery mo=1,+5X XML r P# XQuery f6+ XQuery mo=Da{(e*|, 0 vn"1 vnr`vnDrP# y]G+ SQL 9G XQuery CwwoT,zIDrPvVZa{/PD==+Py; ,: XQuery w*woT (}+ XQuery CwwoT44P XQuery mo=1,a{+Ta{m(_P `M* XML D;P)DN=5XAM'z&CLr#Ka{mPD?PGT XQuery mo=xPs5yzIDrPPD;n#&CLr9CNjSKa{m PCf1,?NCfq=}:XQuery M XMLQUERY zzDa{/.dDnp TB>}5wKb=Vi/=(Da{/.dDnp# g{BP=v XML D5f"Z XML PP,*lwyP *X,IT9C XQuery r XMLQUERY#+G,b=v=(5XDa{/;,,"R&CI&CLr ZSa{/Cf1xP`&&m# Kathy Smith 5 Rosewood Toronto Ontario M6W 1E6 416-555-1358 Robert Shoemaker 1596 Baseline Aurora Ontario N8X 7F8 905-555-7258 416-555-2937 905-555-8743 613-555-3278 + XQuery CwwoT44P XQuery mo=,gTB>}y>: XQUERY db2-fn:xmlcolumn (’CUSTOMER.INFO’)/customerinfo/phone a{/+5X 5 P,gBy>: 416-555-1358 905-555-2937 416-555-2937 905-555-8743 613-555-3278 (} XMLQUERY 4P XQuery mo=,gTB>}y>: Z 5 B i/ XML }] 101 SELECT XMLQUERY (’$doc/customerinfo/phone’ PASSING INFO AS "doc") FROM CUSTOMER a{/+zI 2 P,gBy>,dPmDZ~PPDyP *X"CI%vj ?5(XML rP): 416-555-1358 905-555-2937416-555-2937905-555-8743613- 555-3278 k"b,Ka{/DZ~PP|,;vm>a9;1D XML D5D5# IZ XMLQUERY Gj?/},yTa{/PfZb)np#K/}TmPD?P4 P,"RSmD3;PzIDrP9Ia{/D;P#+G,XQuery 5XrPPD?v nw*a{/D%vP# >}:\mi/a{/ ZK>}P,IT^DO;v SQL i/T|( XQuery D5Zc9l/},C/}7 #zIDP+?|,q={$doc/customerinfo/phone}}’ PASSING INFO AS "doc") FROM CUSTOMER Y(}]bPfZH0T>DG)D5,Ki/Da{/+5X 2 P,gBy>(QT CdvxPq=`ETc|Se~wK)# 416-555-1358 905-555-7258416- 555-2937905-555-8743613-555-3278 CZ%dw}ki/DZa)K;)CZ+i/kyZ XML }]Dw}%dD}# i/GqIT9Cw}!vZz4(Dw}Gqki/f](2F*w}%d),T 0E/wGq!qZi/s5Zd4Pw}(h#5w$_Df!=8+f*zi/ s5Gqf0w}(h# i/XkAYzcBPu~E\9CXML }]w}: v i/Qwu~PD}]`MkQ("w}D}]`M%d# v i/Qwu~|(Td("Kw}D;?VZc# SQL M XQuery E/w E/wf.i/s5"!qi/Zd*9CDw}#i/`kZd,i/k XML w} (ePDyP#=%d,TiR|,5V3?Vi/yhDc;E"Dr!w}# E/wZi/s5ZdI\4PBP=h.;: v ;9Cw}(h|, XML D5Dm 102 pureXML 8O v 9CX5w} v 9CX5w}“k”(AND)Kcrw}“r”(OR)Kc v 9CBD XML w}Kc{ v 9CXML }]w}T%v XML #=xPs5 v 9CXML }]w}“k”(AND)KcM“r”(OR)KcT%Ni/PD4S XML #=xPs5 5w$_ 5w$_*za)CZ!qi/s5Df!=8#i4f!=81,BPKc{+f _zZi/s5Zd}Z9C;v9G8vw}: IXAND T4T=vr|`w}(hDPj64P“k”(AND)Kc# XISCAN (hyZ XML }]Dw}# XANDOR Jm+xPK“k”(AND)KcD=J&CZ`v XML w}# w}(eD^F Ti/Ds5Gqa519Cw}!vZw}(e`TZi/D^FT#BP>}T >I;p9CDtIi/Mw}# xP6'=JDi/Dw} TBi/S_P XML P companydocs Dm companyinfo Plw+>E"Ti R=.,} 35000 D01: SELECT companydocs FROM companyinfo WHERE XMLEXISTS(’$x/company/emp[@salary > 35000]’ PASSING companydocs AS "x") *K#Vf],XML }]w}h*+01=.tTZc|(ZQ("w}DZ cP,"+5w* DOUBLE r DECIMAL `Mf"# i/IT9CBPyZ XML }]Dw}.;,}g: CREATE INDEX empindex on companyinfo(companydocs) GENERATE KEY USING XMLPATTERN ’//@salary’ AS SQL DECIMAL(10,2) CREATE INDEX empindex on companyinfo(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/@salary’ AS SQL DECIMAL(10,2) II`vi/9CDw} TBi/lw+>E"TiR01j6* 31664 01# SELECT companydocs FROM companyinfo WHERE XMLEXISTS(’$x/company/emp[@id="31664"]’ PASSING companydocs AS "x") m;i/lw+>E"TR=j6* K55 D?E# SELECT companydocs FROM companyinfo WHERE XMLEXISTS(’$x/company/emp/dept[@id="K55"] PASSING companydocs AS "x") Z 5 B i/ XML }] 103 *Kkb=vi/f],XML }]w}h*+01j6tTZcM?Ej6t TZc|(ZQ("w}DZcP,"+w}PD5w* VARCHAR `Mf "# i/IT9CTBXML }]w}: CREATE INDEX empdeptindex on companyinfo(companydocs) GENERATE KEY USING XMLPATTERN ’//@id’ AS SQL VARCHAR(25) ^F XQuery =J1|,{FUd NN{ FUd,rK49Cw}#g{Z{ *: kw}(ePD{FUd%d,G4b kZ{`4# *K9i/9Cw},w}D^Fh*OY,ri/D^Fh*O`# TZ`,i/,ITI&9CTBOY^FDw} customer_id_index2: CREATE UNIQUE INDEX customer_id_index2 ON customer(xmlcol) GENERATE KEY USING XMLPATTERN ’/*:Customer/@id’ AS SQL DOUBLE % TB^F|`Di/IT9Cu}Pi/D^F*Y# 8( text() Zc1D"bBn 9C XML #=mo=|( text() ZcI\a0lw}u?DzI#&Zw}(eM= JP;BX9C /text()# 8( text() ZcTw}|D0l XML D5VN: 104 pureXML 8O LauraBrown Finance g{4(TBw}"Z#=)28( text(),G4;aekw}u?,r*y> XML D5,NPD name *X>m;|,D>#vS*X first M last P| ,D># CREATE INDEX nameindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/name/text()’ AS SQL VARCHAR(30) +G,g{4(B;vw}"Z#=)28(*X name,G4+ first M last S*XPDD>"CZekDw}u?P# CREATE INDEX nameindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/name’ AS SQL VARCHAR(30) fZr1Y text() Zc+0lG6S*XDw}u?zI,+T6S*X;P 0l#g{*T6S*X("w},G4(iz;*8( text()#g{8( text(),G4i/9Xk9C text() E\I&%dw}#Kb,#=i$vJC Z*X,;JCZD>Zc# 8(ITk;|, text() DG6SZcD*X%dD XML #=1Xk!D# "Csz*XD>ZcI\This is a great book about XML IT4gBy>`4CZiRX(01U{Di/=J: db2-fn:xmlcolumn(’COMPANY.COMPANYDOCS’)/company/emp[name=’LauraBrown’] UqZ=JMD5P\X*#g{Z=JPD“Laura”M“Brown”.dekU q,G4TBi/;a5XNNZ],r*y> XML D5,N>mPD{k U.d;|,Uq: db2-fn:xmlcolumn(’COMPANY.COMPANYDOCS’)/company/emp[name=’Laura Brown’] xP4OHZ=JDi/Dw} TBi/lw+>E"TiRFq?rP!?PD01# SELECT companydocs FROM companyinfo WHERE XMLExists(’$x/company/emp[dept/text()=’Finance’ or dept/text()=’Marketing’]’ PASSING companydocs AS "x") *K#Vf],XML }]w}h*TQ("w}DZcP?v01yZ?ED D>Zc("w},Tc+5w* VARCHAR `Mf"# i/IT9CTBXML }]w}: Z 5 B i/ XML }] 105 CREATE INDEX empindex on companyinfo(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/dept/text()’ AS SQL VARCHAR(30) Vf5D}]`M *K9i/\;9Cw},Vf5D}]`Mh*kw}D}]`M%d# %dVf5D}]`M TBi/lw+>E"TiRj6* 31201 01# SELECT companydocs FROM companyinfo WHERE XMLEXISTS(’$x/company/emp[@id="31201"]’ PASSING companydocs AS "x") *K#Vf],XML }]w}h*+01j6tTZc|(ZQ("w}DZ cP,"+w}PD5w* VARCHAR `Mf"# CREATE INDEX empindex on companyinfo(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/@id’ AS SQL VARCHAR(5) g{`FDw}(eK AS SQL DOUBLE,G4i/;\9CCw},r*i /=J|(V{.HO#=J @id=″31201″ P9CD+}E9dI*V{.H O,b;\9CV{.w}(VARCHAR)x;\9C}Vw}(DOUBLE) xPs5# *;vT>}V=JMV{.=J.dDnp,3 @id > "3" }V=J @id>3kV{.=J @id > ″3″ ;,#@id 5 10 {O}V= J @id>3,+;{OV{.=J @id > ″3″,-rGZV{.HOP ″3″ s Z ″10″# ,S=J*; &CZ==f+,S=J*;*J1D}]`M# D),S=Jah99Cw}? B,RGIT7(yPXhD%dn}P* a"b M c),(iz4gBy>*;|G: /a/b/c/xs:double(.) g{*4gBy>*;*X,G4ZNNx(*X b PfZ`v*X c Div B,+zzKP1ms: /a/b/xs:double(c) TZ(eK AS SQL VARCHAR Dw},`&D,S=Jh*9C fn:string() /}+QHOD5*;* xs:string }]`M#`,YwJCZ DATE M TIME- STAMP w}#TB>}5wgNZV{.,SP9C fn:string() /}: XQUERY for $i in db2-fn:xmlcolumn("CUSTOMER.INFO")/customerinfo for $j in db2-fn:xmlcolumn("PURCHASEORDER.PORDER")/porder where $i/zipcode/fn:string(.) = $j/supplier/zip/fn:string(.) return {$i}{$j} ,S=JD*;fr\a BmE(&gNZ=K+,S=J*;*`&D}]`MTJm9Cw}# Z 5 B i/ XML }] 107 m 16. ,S=JD*;fr w} SQL `M +,S=J*;* XML `M DOUBLE xs:double DECIMAL xs:decimal INTEGER xs:int VARCHAR integer, VARCHAR HASHED xs:string DATE xs:date TIMESTAMP xs:dateTime #}i/s5 i/I\axP;7(Xs5,"RZ4f0w}(h15Xms#1i/s5f0 =w}(h1,`,i/I\a5X%dD XML }]"R;zzms,-rG}9C|, XQuery mo=DTB VALUES od#Kmo=9C}VHO45X dj6* 17 D XML D5: VALUES( XMLQUERY(’ for $i in db2-fn:xmlcolumn("T.DOC") where $i/emp/id = 17 return $i’)) T mI%v XML P DOC iI,"R|,=v XML D5#BPod+4(Km"e kD5: CREATE TABLE t (doc XML) ; INSERT INTO t VALUES ( ’17’ ); INSERT INTO t VALUES ( ’ABC’ ); }G9C;v(e* SQL INTEGER r SQL DOUBLE D XML }]w}4iRmP %dDD5,qrK XQuery mo=+5Xms#TB CREATE INDEX od+4( w}: CREATE INDEX EMPDBL ON t (doc) GENERATE KEY USING XMLPATTERN ’/emp/id’ as SQL INTEGER IGNORE INVALID VALUES g{mP;fZw},G4 where SdPD}VHOYw+,1&CZmPD%dD5 M;%dDD5#+HOYw&CZ;%dDD51aQw I(} DB2 Net Search Extender T>zf"D XML }]4P+D>Qw# 108 pureXML 8O DB2 Net Search Extender DB2 Net Search Extender j+'V XML }]`M#|9CITTf"Z XML PP DD5("+D>w}#(}T XML P4(D>w},ITi/ XML D5PDyP D>"4P;)Qw(g`FQwr(d{Qw)#DB2 Net Search Extender GCZ Linux"UNIX M Windows D DB2 }]~qwz7D;?V,+Xk%@20# TB>}T>;vr%D+D>Qw,|Z DEPTDOC PPf"D XML D5D76 /dept/description PDNb;CiR%J“marketing”: SELECT DEPTDOC FROM DEPT WHERE contains (DEPTDOC, SECTIONS("/dept/description") "marketing") = 1 DB2 Net Search Extender a)D contains /}Z76 /dept/descriptione PDNND> (|(*XrtT{T0*XrtT5)PQwV{.“marketing”# *9C+D>Qw,Xk9C SQL#+G,TIT+ SQL i/Da{5XA XQuery OBDTxPx;=&m#TB>}T>9C+D>QwD SQL i/zzDa{gN Nk XQuery mo=: XQUERY for $i in db2-fn:sqlquery (’SELECT DEPTDOC FROM DEPT WHERE contains (DEPTDOC, SECTIONS("/dept/description") "marketing") = 1’)//employee return $i/name ZK>}P,9C+D>QwD SQL i/Da{5XA XQuery FLWOR mo=D for Sd#;s,for Sd5XyP *X,"R return Sd5Xlw=D *XPD *X# PX DB2 Net Search Extender D|`E",kND DB2 Net Search Extender D5 r www.ibm.com/software/data/db2/extenders/netsearch# + XML PPD}]lwAOgf>D DB2 M'z g{+}]S XML Plw= DB2 f> 9.1 .0D"PfDM'z,G4}]bM' z;\&m XML }]# Z DRDA® &mZd,1}]b~qwO6=M'z;\'V XML }]1,1!iv B,DB2 }]b~qw+ XML }]5hv* BLOB 5"+}]w* BLOB }]" MAM'z#BLOB }]G XML }]DQrP/V{.m>,"_Pj{D XML y w# g{k*+}]w*} BLOB }]`M.bD}]`MSU,G49CBP=(.;: v *+}]w* CLOB }]lw,k}]b~qwD\m19C db2set |n+~qw OD DB2_MAP_XML_AS_CLOB_FOR_DLC "amd?hC* YES# *c:Z}]b~qwO+ DB2_MAP_XML_AS_CLOB_FOR_DLC "amd?hC * YES 1,yP&ZOg"Pf6pR,SA5}ZDNN}]bD DB2 M'z D CLOB }],+ ;_P XML yw# Z 5 B i/ XML }] 109 v *+}]w* CLOB"CHAR r VARCHAR }]lw,Z DB2 }]b~qw+} ]"MAM'z.0,TP}]wC XMLSERIALIZE /},T8> DB2 }]b~ qw+}]*;*8(D}]`M# g{4wC XMLSERIALIZE 4+}]S}]b~qwlwAOg"Pf6pDM' z,G4Sdlw}]DPDP*klw BLOB r CLOB PDP*;j+`,#} g,d;zITT BLOB P9C LIKE =J,+;\T5X BLOB r CLOB }]D XML P9C LIKE =J# CZ9l XML 5D SQL/XML "P;IS,+G,*f"Z DB2 mPD?v D5Xk|,D5Zc# XMLELEMENT j?/} 5Xw* XML *XZcD XML 5#k"b,XMLELEMENT /};4(D 5Zc,;4(*XZc#Z9l*ekD XML D51,v4(*XZcG ;;D#D5Xk|,9C XMLDOCUMENT /}4(DD5Zc# XMLFOREST j?/} 5Xw* XML *XZcDrPD XML 5# XMLGROUP [//} 5X%v%6*XTm>;vmri/a{#1!ivB,a{/PD?P3 dAPS*X,x?vdkmo=3dAPS*XDS*X#(I!)a{P D?PI3dAPS*X,?vdkmo=I3dAPS*XDtT# 110 pureXML 8O XMLNAMESPACES yw (}Td?9l{FUdyw#Kyw;\Cw XMLELEMENT"XMLFOREST M XMLTABLE /}DTd?# XMLPI j?/} 5X_P%v XQuery &m8nZcD XML 5# XMLROW j?/} 5XP*XrPTm>;vmri/a{#1!ivB,?vdkmo=d; *P*XDS*X#(I!)?vdkmo=Id;*P*XDtT# XMLTEXT j?/} 5X_P%v XQuery D>ZcD XML 5,CD>Zc+dkTd?w*Z ]# XSLTRANSFORM j?/} + XML }]*;*d{q=,|(d{ XML #=# U*X5 9C XMLELEMENT r XMLFOREST 9l XML 51,Z7(*XDZ]1I\v =U5#XMLELEMENT M XMLFOREST D EMPTY ON NULL M NULL ON NULL !nJmz8(Z*XDZ]*U1GzIU*X9G;zI*X#XMLEXISTS D1 !U5&m==G EMPTY ON NULL#XMLFOREST D1!U5&m==G NULL ON NULL# "< XML 5D>} TB>}T>gN9C SQL/XML "}:9C#?59l XML D5 Kr%>}T>gN9C SQL/XML "},k abc def D5|(: v }v*XZc(elem1"child1 M child2) v {FUdyw v D“id”tT v "MZc *9lKD5,4PBP=h: 1. 9C XMLELEMENT 4({*“elem1”D*XZc# 2. 9C XMLNAMESPACES +1!{FUdywmSA D XMLELEMENT /}wC# 3. 9 C XMLATTRIBUTES 4 ( { * “id”D t T , " + C t T E C Z XMLNAMESPACES ywsf# Z 5 B i/ XML }] 111 4. 9C XMLCOMMENT Z D XMLELEMENT /}wCP4("MZc# 5. 9C XMLFOREST /}Z D XMLELEMENT /}wCZ4({* “child1”M“child2”D*X-V# b)=hiOITBi/: VALUES XMLELEMENT (NAME "elem1", XMLNAMESPACES (DEFAULT ’http://posample.org’), XMLATTRIBUTES (’111’ AS "id"), XMLCOMMENT (’example document’), XMLFOREST(’abc’ as "child1", ’def’ as "child2")) >}:9C%vmPD59l XML D5 K>}T>gN9C SQL/XML "}5wgN(}f"Z%vmPD59l XML D5#ZTBi/P,(}9C XMLELEMENT /}C PRODUCT mD name PPD59l?v *X#;s, 9C XMLAGG Z9lD *XZ[/yP *X# SELECT XMLELEMENT (NAME "allProducts", XMLAGG(XMLELEMENT (NAME "item", p.name))) FROM Product p Snow Shovel, Basic 22 inch Snow Shovel, Deluxe 24 inch Snow Shovel, Super Deluxe 26 inch Ice Scraper, Windshield 4 inch (}9C XMLROW /}(x;G9C XMLAGG [/*X),I9l|,P*Xr PD`F XML D5# SELECT XMLELEMENT (NAME "products", XMLROW(NAME as "po:item")) FROM Product zIDdvgBy>: Snow Shovel, Basic 22 inch Snow Shovel, Deluxe 24 inch Snow Shovel, Super Deluxe 26 inch Ice Scraper, Windshield 4 inch 4 record(s) selected. >}:9C`vmPD59l XML D5 K>}T>gN9C SQL/XML "}T>g{(}f"Z`vmPD59l XML D5#ZTBi/P,9C XMLFOREST /}S{* name M numInStock D;i*X9l *X#K- VG9C PRODUCT M INVENTORY mPD59lD#;s,ZQ9lD *XZ[/yP *X# SELECT XMLELEMENT (NAME "saleProducts", XMLAGG (XMLELEMENT (NAME "prod", XMLATTRIBUTES (p.Pid AS "id"), XMLFOREST (p.name as "name", i.quantity as "numInStock")))) FROM PRODUCT p, INVENTORY i WHERE p.Pid = i.Pid O;vi/zzTB XML D5: Snow Shovel, Basic 22 inch 5 Snow Shovel, Deluxe 24 inch 25 Snow Shovel, Super Deluxe 26 inch 55 Ice Scraper, Windshield 4 inch 99 >}:9C|,U*XDmPPD59l XML D5 K>}T>gN9C SQL/XML "}Y( INVENTORY mD LOCATION PZ;PP|,U5#rK,TBi/; 5X *X,r*1!ivB XMLFOREST +US*U: SELECT XMLELEMENT (NAME "newElem", XMLATTRIBUTES (PID AS "prodID"), XMLFOREST (QUANTITY as "quantity", LOCATION as "loc")) FROM INVENTORY 5 8(K EMPTY ON NULL !nD`,i/5X;vU *X: SELECT XMLELEMENT (NAME "newElem", XMLATTRIBUTES (PID AS "prodID"), XMLFOREST (QUANTITY as "quantity", LOCATION as "loc" OPTION EMPTY ON NULL)) FROM INVENTORY 5 >}:9C XQuery "<}] K>}T>gN9C SQL/XML "}|Bmo=44(r%DM'Pm#Cmo=aSM'E "P}%M'j6"X7"(zE"MG$wg0Ek,"+ address Zc*XPD country tTFA customerinfo Zc*X# xquery {for $d in db2-fn:xmlcolumn("CUSTOMER.INFO")/customerinfo return transform copy $mycust := $d modify ( do delete ( $mycust/@Cid , $mycust/addr , $mycust/assistant , $mycust/phone[@type!="work"] ), do insert attribute country { $mycust/addr/@country } into $mycust ) return $mycust } "b,!\>}K address *X,+IZ modify SdPCJX7E","Rekmo =a9C address *XPD country tT# i/+5XTBa{: Kathy Smith 416-555-1358 Kathy Smith 905-555-7258 Jim Noodle 905-555-7258 Robert Shoemaker 905-555-7258 Matt Foreman 905-555-4789 Larry Menard 905-555-9146 SQL/XML "CQ*eq= T>#b)XbV{gBy>: 114 pureXML 8O m 17. XbV{0d5em> XbV{ 5em> < < > > & & ″ " 9C SQL/XML "Z SQL j6P9CD;)V{Z QName P^'#rK,b)V{+f;* QName P|GD5em># }g,(|Z DB2 }]bPDVcq=)*;*|Z&CLrPDrP/V{.q=D}L# ITC DB2 }]b\mw~=4PrP/,2ITwC XMLSERIALIZE /}4T= ks XML rP/#+ XML }]S}]b~qw"MAM'z1,(#*9C XML rP/# Zs`}ivB,~=rP/GW!=(,r*|`kOr%,"R+ XML }]"M AM'z1Jm DB2 M'z}7&m XML }]#T=rP/h*d{&m,b)& mZ~=rP/ZdIM'zT/&m# (#,W!~=rP/,r*Z+}]w* XML }]"MAM'z1||P'#+ G,ZBPivB,nCxPT= XMLSERIALIZE: nC+ XML }]*;* BLOB }]`M,r*lw~xF}]a}:Z C LrP,~=rP/M'j6* ’1000’ D customerinfo D5"+rP/ DD5lw=~xF XML wd?P#lw=D}]9C UTF-8 `k=8,"R|, XML yw# EXEC SQL BEGIN DECLARE SECTION; SQL TYPE IS XML AS BLOB (1M) xmlCustInfo; EXEC SQL END DECLARE SECTION; ... EXEC SQL SELECT INFO INTO :xmlCustInfo FROM Customer WHERE Cid=1000; T= XML rP/ ZT=wC XMLSERIALIZE .s,}]Z}]b~qwP_PG XML }]`M," RTC}]`M"MAM'z# XMLSERIALIZE Jmz8(: v rP/1}]*;*D SQL }]`M C}]`M*V{r~xF}]`M# v dv}]Gq&|(TBT=`kf6(EXCLUDING XMLDECLARATION r INCLUDING XMLDECLARATION): 4T XMLSERIALIZE DdvG Unicode UTF-8 `kD}]# g{+rP/D}]lw=G~xF}]`MP,G4C}]+*;*&CLr` k,+;^D`kf6#rK,}]D`k\I\;{O`kf6#bViva,"Rz9C~= XML rP/,G 4 DB2 }]b~qwZ+}]"MAM'z.0+|*;*BP}]`M.;: – 1!ivB,* BLOB }]`M – g{Z~qwO9C db2set |n+ DB2_MAP_XML_AS_CLOB_FOR_DLC "a md?hC* YES,G4* CLOB }]`M g{k*lw=D}]G;)d{}]`M,G4IT4P XMLSERIALIZE# >}:y>m Customer PD XML P Info |,;vD5,CD5|,H[ZBP} ]DVc: Kathy Smith 116 pureXML 8O 5 Rosewood Toronto Ontario M6W 1E6 416-555-1358 wC XMLSERIALIZE TZ+}]lw=wd?P.0rP/C}]"+|*;* BLOB `M# SELECT XMLSERIALIZE(Info as BLOB(1M)) from Customer WHERE CID=1000 9C XSLT y=mxPd; + XML }]d;*d{q=Dj<=(G(}I)9y=moTd; (XSLT) xP# I9CZC XSLTRANSFORM /}+ XML D5*;* HTML"?D>r;, XML #=# XSLT 9Cy=m+ XML *;*d{}]q=#I*; XML D5D?Vr+?," 9C XPath i/oTM XSLT DZC/}!qrXBEP}]#XSLT (#CZ+ XML *;* HTML,+9ICZ+{O;v XML #=D XML D5d;*{Om; v#=DD5# XSLT 9ICZ+ XML }]*;*^Xq=,gC:E(gDD> r troff .`Dq=/oT#XSLT w*P=vC>: v q=/(+ XML *;* HTML r FOP .`Dq=/oT); v }];;(i/"XiT0+}]S;v XML #=*;*m;v XML #=,r_ *;* SOAP .`D}];;q=)# =Viv#XSL y=m|,;vr`v template *X,|GhvZ?jD~Pv=x( XML *Xri/1*I!DYw#dM XSLT #e*X+(}8(&C*X4t/#}g, ywK#eDZ]+CZf;?j XML D~Pv=DNN jGDZ]# XSLT D~ITGX*3rP>DK`#eDPmiI# TB>}T> XSLT #eDdM*X#ZKivB,?j*|,bfE"D XML D 5,ghv)NDTBG<: Ice Scraper, Windshield 4 inch
Basic Ice Scraper 4 inches wide, foam handle
3.99
Z 5 B i/ XML }] 117 KG<|(@g)ND?~E"hvM[q.`DE"#dP3)E"|,Z . `D*XP#?~E.`DE"|,ZtT(ZKivB* *XD pid t T)P#*+KE"T>* Web 3f,I&CTB XSLT #e:

product ID product name price $ details
XSLT &mw+TO#eM?jD5w*dkSU,|advTB HTML D5:

Ice Scraper, Windshield 4 inch

product ID100-201-01
product nameIce Scraper, Windshield 4 inch
price$3.99
detailsBasic Ice Scraper 4 inches wide, foam handle
118 pureXML 8O XSLT &mwkTx(u~((#?v#e;vu~)bTkV XML D5#g{zc u~,G4#eZ]+ek=dvP;g{;zcu~,G4#e+(}&mw+ ]#y=mI+|T:D}]mSAdv,}g,Z HTML mjGM“product ID”.` DV{.P# XPath ICZ(e#eu~(}g,Z P)T0Z XML wP(}g,Z

P)!q"ek}]# 9C XSLTRANSFORM I9C XSLTRANSFORM /}4T XML }]&C XSLT y=m#g{a)/}" XML D5D{FM XSLT y=mD{F,G4C/}+TD5&Cy=m"5Xa {# g{zZ XSLT y=mP8( XSLT DD5&\,G47#+ DB2_XSLT_ALLOWED_PATH "amd?hCIC?<,Sb)? BIG BAZAAR super market ?v *X|{;vN},"Z value tTP|,d5(TZO$D5,r| ,Z*X>mP)#Ov>}T>=vde# XSLT #eD~JmDN}G9C *Xw*d?(eD,gBy>: ZK>}P,IZy=mZDNN;CwC $headline r $supermarketname d?," R|G+|,N}D~P(eDD~(ZKivB,Vp*V{.“BIG BAZAAR super market”05“true”)# >}:+ XSLT Cwq=/}f ;v>},]>gN+ZC XSLTRANSFORM /}Cwq=/}f# K>}]>gN+ XSLT Cwq=/}f#*xPhC,H+TB=v>}D5ek= }]bP# INSERT INTO XML_TAB VALUES (1, ’ Z 5 B i/ XML }] 119 ’, ’

StudentID First Name Last Name Age University
’ ); BfwC XSLTRANSFORM /}T+ XML }]*;* HTML "T>v4# SELECT XSLTRANSFORM (XML_DOC USING XSL_DOC AS CLOB(1M)) FROM XML_TAB; a{*TBD5:

120 pureXML 8O
StudentID First NameLast Name Age
1 SteffenSiegmund 23
ZK>}P,dv* HTML "Rb)N}v0lzzD HTML Z]0a)D}]# by|a]>gN+ XSLT CwnUC'dvDq=/}f# >}:9C XSLT 4xP}];; ;v>},]>gN9CZC XSLTRANSFORM /}*; XML D54xP}];;# K>}]>gN(}9CN}My=mZKP1zz;,}];;q=# 9C|, xsl:param *XDy=m6qN}D~PD}]# INSERT INTO Display_productdetails values(1, ’

product ID product name price details BIG BAZAAR super market
’ ); CN}D~|,T&Z XSLT #ePDN}DN}0Z]: Z 5 B i/ XML }] 121 CREATE TABLE PARAM_TAB (DOCID INTEGER, PARAM VARCHAR (10K)); INSERT INTO PARAM_TAB VALUES (1, ’ BIG BAZAAR super market ’ ); ;s,I9CTB|nZKP1&CN}D~: SELECT XSLTRANSFORM (XML_DOC USING XSL_DOC WITH PARAM AS CLOB (1M)) FROM product_details X, PARM_TAB P WHERE X.DOCID=P.DOCID; a{* HTML,+|,IN}D~7(DZ]0T XML D5Z]4PDbT:

product ID product Name price Details
Zd{&CLrP,XSLTRANSFORM Ddv;\* HTML,+ITGm; XML D 5r9Cm;}]q=DD~,g EDI D~# TZ}];;&CLr,N}D~I|, EDI r SOAP D~7E"(ggSJ~rK ZX7),rTX(Bq(;Dd{X|}]#r*Ov>}P9CD XML GbfG <,yTITaIkqgN9C XSLT XBr|KG}:9C XSLT 4}%{FUd zSU=D XML D5I\|,;h*r_;}7D{FUdE"#IT9C XSLT y =m4}%r&mD5PD{FUdE"# BP>}5wgN9C XSLT 4}% XML D5PD{FUdE"#b)>}+ XML D5M XSLT y=mf"Z XML PP,"9C XSLTRANSFORM /}R9CdP ;V XSLT y=m4*; XML D5# BP CREATE od+4( XMLDATA M XMLTRANS b=vm#XMLDATA mP |,;vy> XML D5,XMLTRANS mP|, XSLT y=m# CREATE TABLE XMLDATA (ID BIGINT NOT NULL PRIMARY KEY, XMLDOC XML ); CREATE TABLE XMLTRANS (XSLID BIGINT NOT NULL PRIMARY KEY, XSLT XML ); 9CTB INSERT od+y> XML D5mSA XMLDATA m# 122 pureXML 8O insert into XMLDATA (ID, XMLDOC) values ( 1, ’ Matt Foreman 1596 Baseline Toronto Ontario M3Z 5H9 905-555-4789 416-555-3376 Gopher Runner 416-555-3426 ’); CZ}%yP{FUdD>} XSLT y=m TB>}9C XSLT y=mSf"Z XMLDATA mZD XML D5P}%yP{F UdE"#b)>}+y=mf"Z XMLTRANS mP,"9C SELECT od+Ky =m&CZ XML D5# 9C INSERT od+Ky=mmSA XMLTRANS m# insert into XMLTRANS (XSLID, XSLT) values ( 1, ’ ’) ; TB SELECT od9C XSLT y=m4*;y> XML D5# SELECT XSLTRANSFORM (XMLDOC USING XSLT ) FROM XMLDATA, XMLTRANS WHERE ID = 1 and XSLID = 1 XSLTRANSFORM |n9CZ;v XSLT y=m4*; XML D5,+5XTB XML "}%yP{FUdE"# Z 5 B i/ XML }] 123 Matt Foreman 1596 Baseline Toronto Ontario M3Z 5H9 905-555-4789 416-555-3376 Gopher Runner 416-555-3426 CZ#t*XD{FUds(D>} XSLT y=m TB>}9C XSLT y=m4v#t phone *XZcD{FUds(#KZcD{F Z XSLT d? mynode P8(#b)>}+y=mf"Z XMLTRANS mP,"9C SELECT od+Ky=m&CZ XML D5# 9CTB INSERT od+Ky=mmSA XMLTRANS m# insert into XMLTRANS (XSLID, XSLT) values ( 2, ’ phone 124 pureXML 8O ’); TB SELECT od9CZ~v XSLT y=m4*;y> XML D5# SELECT XSLTRANSFORM (XMLDOC USING XSLT) FROM XMLDATA, XMLTRANS WHERE ID = 1 and XSLID=2; XSLTRANSFORM |n9CZ~v XSLT y=m4*; XML D5,"5XTB XML T0v phone *XD{FUd# Matt Foreman 1596 Baseline Toronto Ontario M3Z 5H9 905-555-4789 416-555-3376 Gopher Runner 416-555-3426 >}:9C XSLT DD5&\ TB>}bM9C XSLT DD5&\yhDyP=h# Z pureXML P;Fv9C XSLT DZC&\#+G,g{zv(9C XSLT DD5 &\,G4XkT|, XML D5D?}bMgNT2+==9C XSLT DD5&\# b)>}+ XML D5M XSLT y=mf"Z XML PP,"9C XSLTRANSFORM /}R9CdP;V XSLT y=m4*; XML D5#b)>}9C* Z 122 3D:> }:9C XSLT 4}%{FUd; 4(D XMLDATA M XMLTRANS m# Linux M UNIX 73D>} ZK>}P,XML D~;Z /home/user/xml_files ? ’) ; TB SELECT od9CxP XSLID = 3 D XSLT y=m*;y> XML D5# SELECT XSLTRANSFORM (XMLDOC USING XSLT ) FROM XMLDATA, XMLTRANS WHERE ID = 1 and XSLID = 3 XSLTRANSFORM |n9C XSLT y=m*; XML D5,"5X*;D XML D 5#g{C}]b\mw^(r* XSLT DD5&\P8(DD5,G4vT=D5& \DwC# Windows 73D>} ZK>}P,XML D~;Z C:\Documents and Settings\user\xml_files ? ’) ; TB SELECT od9CxP XSLID = 4 D XSLT y=m*;y> XML D5# SELECT XSLTRANSFORM (XMLDOC USING XSLT ) FROM XMLDATA, XMLTRANS WHERE ID = 1 and XSLID = 4 XSLTRANSFORM |n9C XSLT y=m*; XML D5,"5X*;D XML D 5#g{C}]b\mw^(r* XSLT DD5&\P8(DD5,G4vT=D5& \DwC# d; XML D5DX*"bBn 9CZC XSLTRANSFORM /}*; XML D51,P;)X*"bBnM^F# d; XML D51"bBPBn: v 4 XML D5XkG%;y"Rq= AMPERSAND U+0026 & LESS-THAN SIGN U+003C < GREATER-THAN SIGN U+003E > v ZtT5rD>5Z,3)V{+f;*|GD}Vm>#b)V{0d}Vm> *: V{ Unicode 5 5em> CHARACTER TABULATION U+0009 LINE FEED U+000A CARRIAGE RETURN U+000D NEXT LINE U+0085 … LINE SEPARATOR U+2028 
 v ZtT5Z,QUOTATION MARK (U+0022) V{+f;*|D$(e XML 5e "# v g{dkD5_P DTD yw,G4;a#tCyw,"R;azIyZ DTD Dj G# v g{dkD5|, CDATA ?V,G4dvP;a#tb)?V# 128 pureXML 8O Z 6 B * XML }]("w} XML }]w}ICZa_i/f"Z XML PPD XML D5D'J# kw}|I8(D;vr`vmPiID+3X5w};,,XML }]w}9CX( XML #=mo=Tf"Z%vPPD XML D5PD76M5("w}#CPD}] `MXkG XML# XML }]w}y] XML #=mo=4(w}|,Sxa)TD5ZDZcDCJ, x;Ga)TD5*7DCJ#r*I\ XML D5PD`v?V<{O XML #=, yTIT+`vw}|ek;vD5Dw}P# IT9C CREATE INDEX od4(XML }]w},9C DROP INDEX od>} XML }]w}#f CREATE INDEX od|(D GENERATE KEY USING XMLPATTERN Sd8(k*("w}DTs# k CREATE INDEX od;pCZG XML PDw}D;)X|V;JCZyZ XML }]Dw}#TZyZ XML }]Dw},UNIQUE X|V2P;,D,e# >}:4(XML }]w} Y(m companyinfo P;v{* companydocs D XML P,||,ngTBZ]D XML D5,N: Company1 DD5 Laura Brown Finance Company2 DD5 Chris Murphy Marketing Nicole Murphy © Copyright IBM Corp. 2006, 2013 129 Sales companyinfo mDC'(#9C01j6lw01E"#IT9CngTBDw}9l w'J|_: < 5 D"M: 1 XML }]w}GT companyinfo mD companydocs P(eD#companydocs XkG XML }]`M# 2 GENERATE KEY USING XMLPATTERN Sda)XZk*("w}DTs DE"#KSdF* XML w}f6#XML w}f6|, XML #=Sd# K>}PD XML #=Sd8>k*T?v01*XDj6tT5("w}# 3 AS SQL DOUBLE 8>Q("w}D5f"* DOUBLE 5# w} XML #=mo= ;Tf"Z XML PP"zc XML #=mo=DG?V XML D5("w}#*T XML #=("w},f CREATE INDEX od;pa)w}f6Sd# w}f6SdT GENERATE KEY USING XMLPATTERN *7,sz XML #=M XML }]w}D}]`M#r_,IT8(Sd GENERATE KEYS USING XMLPATTERN# ?v CREATE INDEX od;JmP;vw}f6Sd#ITT;v XML P4(` v XML w}# XML #=mo= *j6+("w}DG?VD5,I9C XML #=48( XML D5ZDZc/#K #=mo=k XQuery oTP(eD76mo=`F,dnpZZ0_v'V;?V XQuery oT# 76mo==hI}1\(/)Vt#9IT8(+}1\ (//),|G /descendant-or- self::node()/ Du4o(#Z?v=hP,!q}ra(child::, @, attribute::, descen- dant::, self:: M descendant-or-self::),;s!q XML {FbTr XML V`bT#g {48(}ra,G49C child aw*1!5# g{9C XML {FbT,G49C^( XML {Fr(d{48(k76PD=h% dDZc{#XML V`bT;%dZc{,+|2IC48(#=P*%dDZcDV `:D>Zc""MZc"&m8nZcrNNd{`MDZc# #=mo=IT|,T\'V/}DwC,T4(_PXbtT(}g,;xVs! 4)Dw}#?v XMLPATTERN Sd;Jm;v/}=h# CREATE INDEX empindex on companyinfo(companydocs) 1 GENERATE KEY USING XMLPATTERN ’/company/emp/@id’ 2 AS SQL DOUBLE 3 < 5. XML }]w}D>} 130 pureXML 8O TB>}T>_-Ok;,#=mo=H'Dod# od 1 M 2 Z_-OH'#od 1 9Cu4Do(# od 3 Mod 4 Z_-OH'#od 3 9Cu4Do(# od 5 9C XML V`bT4%d8(#=PDD>`MZc: CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/name/last/text()’ AS SQL VARCHAR(25) od 6 M 7 +4(;xVs!4Dw}#od 7 8(&CZDVoT73B*;w }Pf"D5# CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/name/last/fn:upper-case(., "en_US")’ AS SQL VARCHAR(25) od 8 4(w},Cw}8>01DPd{Z XML D5a9PGqfZ# CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/@id’ AS SQL DOUBLE < 6. od 1 CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/child::company/child::emp/attribute::id’ AS SQL DOUBLE < 7. od 2 CREATE INDEX idindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’//@id’ AS SQL DOUBLE < 8. od 3 CREATE INDEX idindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/descendant-or-self::node()/attribute::id’ AS SQL DOUBLE < 9. od 4 < 10. od 5 CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/name/last/fn:upper-case(.)’ AS SQL VARCHAR(25) < 11. od 6 < 12. od 7 < 13. od 8 Z 6 B * XML }]("w} 131 CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/name/fn:exists(middle)’ AS SQL VARCHAR(1) od 9 4( VARCHAR w}# S DB2 V10.1 *<,E/wIT!q+ VARCHAR `MDw}CZ_P|, fn:starts- with /}D=JDi/#fn:starts-with /}7(V{.GqTX(S.*7#;h*| DVP VARCHAR w},"R;h*ZCZ4(Bw}D CREATE INDEX odP9 CXbo(# ^(76MZc }P,CREATE INDEX odPD XMLPATTERN ’/company/emp/@id’ 8(%v764}CD5PDm`;,Zc,r *D5PD?v01*X}P,8(K descendant-or-self a,Tc XML # = ’//@id’ }C?Ej6tTM01j6tTD76,r*|G<|, @id# CREATE INDEX idindex on company(companydocs) GENERATE KEYS USING XMLPATTERN ’//@id’ AS SQL DOUBLE g{*T;xVs!4D==ZU{*XPQwX(01DU (),G4ITT XML #= ’/company/emp/name/last/fn:upper-case(.)’ 4(w}#;s,_Pq= * ’/company/emp/name/last[fn:upper-case(.)="SMITH"]" D=JDi/IT{C XML PDw}#ZK>}P,XML #=DOBD=h8(%v76 ’/company/emp/name/ last’#TZK76,D5PDm`;,ZcI\{Ou~,r*D5PD?vU{* X *X#+Ts4N=("yP01DUDw}# CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/name/last/fn:upper-case(.)’ AS SQL VARCHAR(25) g{ XML #=|, fn:exists /},G4w}5+f"*%vV{ T r F,T8>* ("w}DnZ XML D5a9PGqfZ#ZTB>}P,+T<{5==("yP 01DPd{Dw}# CREATE INDEX midnameidx on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/name/fn:exists(middle)’ AS SQL VARCHAR(1) CREATE INDEX varcharidx on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/name/last’ AS SQL VARCHAR(30) < 14. od 9 132 pureXML 8O 9C;xVs!4D XML w}D>} *a_QwV{.}]Di/DYH,IT9C fn:upper-case() /}44(+5f"* ;xVs!4Du?Dw}# 4(;xVs!4Dw} K>}5wgN4(_P XML PDm"ZCmPek}]T04(;xVs!4Dw }# WH4({* CLIENTS Dm,CmP;v{* CONTACTINFO DP,d`M* XML: CREATE TABLE clients ( ID INT PRIMARY KEY NOT NULL, NAME VARCHAR(50), STATUS VARCHAR(10), CONTACTINFO XML ); +=uG
8734 Zuze Ave. New York New York 95443
’); INSERT INTO clients VALUES(’0093’, ’Rose Locke’, ’Golden’, ’
1121 Oxford Street Albany new york 19232
’); ITT /Client/address/state 764(;xVs!4Dw},}g, clients_state_idx#fn:upper-case() /}DZ;vN}XkNew York new york 2 record(s) selected. 8(oT73N} 4(;xVs!4Dw}1,IT9C fn:upper-case /}DI!oT73N}#}g, TBod+* tr_TR oT73T address tTD`M(_P76 /Client/address/ @type)4(w}: CREATE INDEX client_address_type_idx_tr ON clients(contactinfo) GENERATE KEYS USING XMLPATTERN ’/Client/address/@type/fn:upper-case(., "tr_TR")’ AS SQL VARCHAR(50); "b,g{4}78(oT73V{.(}g,!TK=_D}E),G4a+1! 5CZoT73{F#*i$4(w}Zd9CDoT73,IT9C db2look |nr DESCRIBE od#}g:DESCRIBE INDEXES FOR TABLE CLIENTS SHOW DETAIL# v1i/9Zi/=JP(} fn:upper-case() 8(KoT73 tr_TR 1,E/wEI\ !q9C client_address_type_idx_tr w}#}g: SELECT id FROM clients client1 WHERE XMLEXISTS(’$XMLDOC/Client/address/@type[fn:upper-case(., "tr_TR")="PERMANENT"]’ PASSING client1.contactinfo as "XMLDOC") ID ----------- 92 93 2 record(s) selected. TZngTB>}.`Di/,49C client_address_type_idx_tr w},bGr*Ci /8(Kd{oT73: SELECT id FROM clients client1 WHERE XMLEXISTS(’$XMLDOC/Client/address/@type[fn:upper-case(., "en_US")="PERMANENT"]’ PASSING client1.contactinfo as "XMLDOC") ID ----------- 134 pureXML 8O 92 93 2 record(s) selected. 9C8(K fn:exists Dw}D>} IT9C fn:exists /}44(CZf"<{5(%vV{ T r F)Dw},T8>* XrtTGqfEK}]5(x;GUrP)# 4(_P fn:exists Dw} K>}5wgN4(_P XML PDm"ZCmPek}]T04(9C fn:exists / }Dw}# WH4({* INCOME Dm,CmP;v{* INCOMEINFO DP,d`M* XML: CREATE TABLE income ( ID INT PRIMARY KEY NOT NULL, INCOMEINFO XML ); +}uG 5500.00 1000.00 ’); INSERT INTO income VALUES(’2’, ’ 7600.00 ’); INSERT INTO income VALUES(’3’, ’ 2600.00 500.00 ’); IT9C76 /Employee/salary/fn:exists(bonus) 44(w}(}g,{* exists_bonus_idx w}),TliD)01P1p: CREATE INDEX exists_bonus_idx ON income(incomeinfo) GENERATE KEYS USING XMLPATTERN ’/Employee/salary/fn:exists(bonus)’ AS SQL VARCHAR(1); 9IT9C76 /Employee/salary/fn:exists(@*) 44(w}(}g,{* exists_any_attrib_idx w}),Tli salary *XGqfZNNtT: CREATE INDEX exists_any_attrib_idx ON income(incomeinfo) GENERATE KEYS USING XMLPATTERN ’/Employee/salary/fn:exists(@*)’ AS SQL VARCHAR(1); Z 6 B * XML }]("w} 135 KP9CKb)w}Di/ v1TB=vyw5500.001000.00 2600.00500.00 2 record(s) selected. ICTBq=4`4Ki/1,2a5500.001000.00 2600.00500.00 2 record(s) selected. TB=vi/+7600.00 1 record(s) selected. XQUERY db2-fn:xmlcolumn(’INCOME.INCOMEINFO’) /Employee/salary[fn:not(fn:exists(bonus))]; -------------------------------- 7600.00 1 record(s) selected. TZTBi/,E/wI\!q9Cw} exists_any_attrib_idx#Kw}li salary * XDNNtT#Z>}}]P,vfZ type tT#rK,ZK>}P,v1 XML 7 6 /Employee/salary PfZtT @type 1,i/=JE* true: XQUERY db2-fn:xmlcolumn(’INCOME.INCOMEINFO’) /Employee/salary[fn:exists(@type)]; -------------------------------- 5500.001000.00 7600.00 2 record(s) selected. TZICTBq=`4Di/,E/w2a5500.001000.00 1 record(s) selected. XQUERY db2-fn:xmlcolumn(’INCOME.INCOMEINFO’) /Employee/salary[bonus and base > 3000]; -------------------------------- 5500.001000.00 1 record(s) selected. XQUERY db2-fn:xmlcolumn(’INCOME.INCOMEINFO’) /Employee/salary[bonus and bonus > 600]; -------------------------------- 5500.001000.00 1 record(s) selected. XQUERY db2-fn:xmlcolumn(’INCOME.INCOMEINFO’) /Employee/salary[bonus][bonus > 600]; -------------------------------- 5500.001000.00 1 record(s) selected. XQUERY for $e in db2-fn:xmlcolumn(’INCOME.INCOMEINFO’) /Employee/salary where $e/bonus return $e; -------------------------------- 5500.001000.00 2600.00500.00 1 record(s) selected. 9C UNIQUE X|V4(Dw} TZ9C UNIQUE X|V4("R9Z XMLPATTERN SdP8(K fn:exists /} Dw},(;oe+vTw}#=DOBD=h4} S DB2 V10.1 *<,TZ_P|, fn:starts-with /}D=JDi/,E/wIT!q 9C VARCHAR `MDw}4a_i/YH# ;h*|DVP VARCHAR w},"R;h*Z4(BD VARCHAR w}1Z CRE- ATE INDEX odP9CNNXbo(# fn:starts-with /}7(V{.GqTX(S.*7# Z 6 B * XML }]("w} 137 4( VARCHAR `MDw} K>}5wgN4(_P XML PDm"ZCmPek}]T04( VARCHAR `M Dw}# WH4({* FAVORITE_CDS Dm,CmP;v{* CDINFO DP,d`M* XML: CREATE TABLE favorite_cds ( NAME CHAR(20) NOT NULL, CDID BIGINT, CDINFO XML ); +G Top hits Good Singer Top Records 1999 More top hits Better Singer Better Music 2005 Even more top hits Best Singer Best Music 2010 ’); ITT /FAVORITECDS/CD/YEAR 764( VARCHAR w}(}g,{* year_idx D w}),}g: CREATE INDEX year_idx ON favorite_cds (cdinfo) GENERATE KEYS USING XMLPATTERN ’/FAVORITECDS/CD/YEAR’ AS SQL VARCHAR(20); 9ITT /FAVORITECDS/CD/COMPANY 764( VARCHAR w}(}g,{* company_idx Dw})#TB>}(}9C fn:upper-case /}T+>{F4(;xV s!4Dw}: CREATE INDEX company_idx ON favorite_cds (cdinfo) GENERATE KEYS USING XMLPATTERN ’/FAVORITECDS/CD/COMPANY/fn:upper-case(.)’ AS SQL VARCHAR(20); KP_P|, fn:starts-with D=JDi/ TZTBi/,E/wI\!q9C VARCHAR w} year_idx x;G4Pm(h4 iR 20 @M 90 jzD CD(ZK>}P,fn:starts-with /}+iRdj]T 199 * 7D CD)#g{ year_idx w}f0D$w?O!,G4E/wIT!q9CCw}# XQUERY for $y in db2-fn:xmlcolumn (’FAVORITE_CDS.CDINFO’)/FAVORITECDS/CD/YEAR [fn:starts-with(., "199")]/.. return $y 138 pureXML 8O -------------------------------- Top hits Good Singer Top Records 1999 1 record(s) selected. "b,g{`4i/1ICK* fn:starts-with /}DZ;vN}8(OBDnmo= (.) Dq=,G4b)i/;JmE/w!q(h;vw},xd{q=Di/I\h* (h=vw}#rK,ICTBq=`4D`Fi/dKPYHI\}\`: XQUERY for $y in db2-fn:xmlcolumn (’FAVORITE_CDS.CDINFO’)/FAVORITECDS/CD [fn:starts-with(YEAR, "199")] return $y TZB;vi/,E/wI\!q9C VARCHAR w} company_idx x;G4Pm (h4iRdPD+>{FT BES *7DG<#g{ company_idx w}f0D$w ?O!,G4E/wIT!q9CCw}# XQUERY for $y in db2-fn:xmlcolumn (’FAVORITE_CDS.CDINFO’)/FAVORITECDS/CD/COMPANY [fn:starts-with(fn:upper-case(.), "BES")]/.. return $y -------------------------------- Even more top hits Best Singer Best Music 2010 1 record(s) selected. OBD=hM/}mo==h OBD=hM/}mo==hG4( XML }]D/}w}18(D XML w}#MD ;?V# OBD=h(e*("w}Dbi*XrtTZcD XML w}#=#/}mo==h 8(CZ(e*f"Zw}PD|5D/}# (#ivB,9C/}(}g,fn:exists M fn:upper-case)44(yZ XML }]D/ }w}1,zZ GENERATE KEYS USING XMLPATTERN SdP8(D XML #= mo=_P=v?V# Z;v?VF*OBD=h#OBD=h8(*XZcrtTZcD XML 76,+* b)Zc4(w}u?#TZ XML w},OBD=hyq-Do((#kw}#=m o=Do(`,,+Co(kX(/}(}g,fn:upper-case M fn:exists)dO9C1 fZ3)^F#kNDPX9C CREATE INDEX odDE",TKbj8E"# Z~v?VF*/}mo==h#/}mo==h8(/}(}g,fn:exists r fn:upper- case)0dN}#/}mo==h*OBD=hy8(D?vZczI*f"Zw}P D5J|5# }g,TZw} XML #= /a/b/fn:upper-case(.): v OBD=hG /a/b v /}mo==hG fn:upper-case(.) Z 6 B * XML }]("w} 139 mY;},TZw} XML #= /a/b/fn:exists(c): v OBD=hG /a/b v /}mo==hG fn:exists(c) XML {FUdyw ^( XML {F(QName)CZ(e XML #=mo=PD*XMtTjG#QName D^({G;vQ-k{FUd URI `X*D{FUd0:# IT9CI!{FUdyw48( XML #=,T+{FUd0:3dA{FUd URI V{.DV,r_* XML #=(e1!{FUd URI#;s,+{FUd0:C4^ ( XML #=PD*XMtTD{F,T9|GkD5P9CD{FUd`%d# ZTB>}P,+u4{FUd0: m 3dA http://www.mycompanyname.com/ CREATE INDEX empindex on department(deptdocs) GENERATE KEYS USING XMLPATTERN ’declare namespace m="http://www.mycompanyname.com/"; /m:company/m:emp/m:name/m:last’ AS SQL VARCHAR(30) k"b,g{S|nP&mw(CLP)"vK CREATE INDEX od,G46kDVE +vVJb,r*VEG1!odU9{#*K\bKJb,9CBPd(=(. ;: v 7#VE;G;PPDns;vGUqV{(}g,(}ZVEsfmSUD XQuery "M)# v S|nP|D CLP PD1!odU9{# 9ITZ,;v XMLPATTERN mo=P8(`v{FUdyw,+{FUd0:Z {FUdywPmPXk(;#Kb,C'9IT!q*;P0:D*Xyw1!{ FUd#g{;P**XT=8({FUdr{FUd0:,G4+9C1!{FU d#1!{FUdyw;JCZtT#g{C'48(1!{FUd,G4{FUd +* no namespace#;\yw;v1!{FUd#K{FUdywP*qS XQuery f r# 9IT9C1!{FUd`4O;v>}: CREATE INDEX empindex on department(deptdocs) GENERATE KEY USING XMLPATTERN ’declare default element namespace "http://www.mycompany.com/"; /company/emp/name/last’) AS SQL VARCHAR(30) ZB;v>}P, @id tT_P no namespace {FUd,bGr*1!{FUd http:// www.mycompany.com/ vJCZ company M emp *X,+;JCZ @id tT#bq Xy> XQuery fr,r*Z XML D5P,1!{FUdyw;JCZtT# CREATE INDEX empindex on department(deptdocs) GENERATE KEY USING XMLPATTERN ’declare default element namespace "http://www.mycompany.com/"; /company/emp/@id’ AS SQL VARCHAR(30) IZ @id tT&C_Pk company M emp *X`,D{FUd,yTIT4gBy >`4od: 140 pureXML 8O CREATE INDEX empindex on department(deptdocs) GENERATE KEY USING XMLPATTERN ’declare default element namespace "http://www.mycompany.com/"; declare namespace m="http://www.mycompanyname.com/"; /company/emp/@m:id’ AS SQL VARCHAR(30) CZ4(w}D{FUd0:k5}D5P9CD{FUd0:;h*%d4I(" w},+j+)9D QName h*%d#0:)9*D{FUdD5(x;G0:{> m)G#X*#}g,g{w}D{FUd0:(e* m=″http//www.mycompany.com/″, "R5}D5P9CD{FUd0:* c=″http//www.mycompany.com/″,G4+T5} D5PD c:company/c:emp/@id ("w},r*u4{FUd0: m M c <)9*, ;{FUd# kw} XML #=mo=X*D}]`M Z CREATE INDEX odP8(D?v XML #=mo=Xkk}]`MX*#'V TB SQL }]`M:VARCHAR"DATE"TIMESTAMP"DECIMAL M DOUBLE# IT!q+mo=Da{bM*`V}]`M#}g,5 123 _PV{m>,+2IT +|bM*}V 123#g{#{+76 /company/emp/@id ,1w*V{.M}V54 ("w},G4Xk4(=vw},;vm> VARCHAR }]`M,;vm> DOUBLE }]`M#+D5PD5*;*T?vw}8(D}]`M# TB>}5wgNT,;v XML P deptdocs 4(=v_P;,}]`MDw}: CREATE INDEX empindex1 on department(deptdocs) GENERATE KEY USING XMLPATTERN ’/company/emp/@id’ AS SQL VARCHAR(10) CREATE INDEX empindex2 on department(deptdocs) GENERATE KEY USING XMLPATTERN ’/company/emp/@id’ AS SQL DOUBLE hv\'VD SQL }]`M: VARCHAR(integer) IC UTF-8 zk3+ VARCHAR }]f"Z XML PDw}P#g{+}]` M VARCHAR k8(D$H integer(TVZ*%;)dO9C,G4+8(D$ HS*}P,53T{vV{.z I 8 vVZD"Pzk,"RTQ("w}DV{.D$H;P^F#g{8( VARCHAR HASHED,G4^(4P6'(h,r*w}|,"Pkx;G5JD V{}]#;\+9Cb)"PV{.Dw}CZ`Hi/#XQuery oeCZV{ Z 6 B * XML }]("w} 141 .`HHO,dPD2?UqG#X*#bk SQL oe;,,dPD2?UqZH OZd;X*#V{."P#t XQuery `Hoe,+;#t SQL `Hoe# CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/name/last’ AS SQL VARCHAR HASHED DOUBLE +*;yP}5"+|Gw* DOUBLE }]`Mf"Zw}P#^^sD.xF `MM 64 ;{}Zw* DOUBLE f"1I\a*'+H#w} SQL }]`M DOUBLE D5I\|(Xb}V5 NaN"INF"-INF"+0 M -0,49 SQL }] `M DOUBLE >m;'Vb)5# INTEGER +*;yP{O XML #=`M xs:int D}V5"+|Gw* INTEGER }]` Mf"Zw}P#"b,XML #=+(e`V{}}]`M,dP|( xs:int M xs:integer#xs:int D_gT&Z SQL `M INTEGER D_g,x xs:integer r4 (e_g#g{v=,v xs:int D_gD5,G4a5Xms# CREATE INDEX intidx on favorite_cds(cdinfo) GENERATE KEYS USING XMLPATTERN ’/favoritecds/cd/year’ AS SQL INTEGER IT+%J INT Cw SQL }]`M INTEGER D,eJ# DECIMAL(integer, integer) +*;yP}V5"+|Gw* DECIMAL }]`Mf"Zw}P#Z;v{}G }VD+H(4};\});|D6'I\Z 1 A 31 .d#Z~v{}G}VD !};}(4!}cR_D};});|D6'I\Z 0 A}V+H.d#g{4 8(+HM!};},G4+Vp9C1!5 5 M 0# CREATE INDEX decidx on favorite_cds(cdinfo) GENERATE KEYS USING XMLPATTERN ’//price’ AS SQL DECIMAL(5,2) IT+%J DEC"NUMERIC M NUM Cw DECIMAL D,eJ# DATE Z+ DATE }]`M5f"Zw}P.0,+|Gf6/* UTC(+rj<1d) rf31d#k"b,XML #=}]`MD DATE JmD+HsZ SQL }]` M#g{v=,v6'D5,G4+5Xms# CREATE INDEX BirthdateIndex ON personnel(xmlDoc) GENERATE KEY USING XMLPATTERN ’/Person/Confidential/Birthdate’ AS SQL DATE TIMESTAMP Z+ TIMESTAMP }]`M5f"Zw}P.0,+|Gf6/* UTC(+rj <1d)rf31d#k"b,TZ1dAG,XML #=}]`MJmD+HsZ SQL }]`MJmD+H#g{v=,v6'D5,G4+5Xms# CREATE INDEX LastLogonIndex ON machines(xmlDoc) GENERATE KEY USING XMLPATTERN ’/Machine/Employee/LastLogon’ AS SQL TIMESTAMP yZ XML }]Dw}D}]`M*; Z+5ek=XML }]w}P.0,XkH+|G*;*kw} SQL }]`MT&D w} XML `M# 142 pureXML 8O TZ VARCHAR(integer) M VARCHAR HASHED,(}9C XQuery /} fn:string + 5*;* xs:string 5#+ VARCHAR(integer) D$HtTw*;Vm;'Vb)5# `&Dw}}]`M m 18. `&Dw}}]`M XML }]`M SQL }]`M xs:string VARCHAR(integer) M VARCHAR HASHED xs:double DOUBLE xs:date DATE xs:dateTime TIMESTAMP xs:int INTEGER xs:decimal DECIMAL(integer, integer) ^' XML 5 XML #=5G CREATE INDEX odD xmlpattern-clause zIDQ("w}D5# TZ9C}]`M DOUBLE"INTEGER"DECIMAL"DATE M TIMESTAMP Dw}, a9C XQuery ?F`M*;mo=+ XML #=5*;*w} XML }]`M#; PT?jw} XML }]`MNIP'DJ(q=D XML 5;S*^' XML 5# }g,ABC G xs:double }]`MD^' XML 5#w}&m^' XML 5D==!v Z CREATE INDEX odD xmltype-clause PG8(K REJECT INVALID VALUES !n9G IGNORE INVALID VALUES !n# REJECT INVALID VALUES 8(yP XML #=5DP' XML 5 (r*Z? DB2 V^T),G4a"vms#Xk"vCmsT,$;BTa {:g{4PK9CCw}Di/,G4i/D}7a{I\|,,v\'V ^FD5(-rGC5GP' XML 5)#*\bi/5X;j{Da{,a "vmsT,$;BDa{# m 19. ;)Z? DB2 V^T>} XML }]`M XML #= DB2 6'(n!5 :ns 5) xs:date ;Pnsj]^F 'VUZ*:} 0001-01-01: 9999-12-31 xs:dateTime ;Pnsj]^F 'VUZ*:} 'VNb+HD!}k 0001-01-01T00:00:00.000000Z: 9999-12-31T23:59:59.999999Z xs:integer TZn!5rns56';P ^F -9223372036854775808: 9223372036854775807 DB2 }]b~qw;'V XML 5Dj{6'#;'VD56'|(: v j]sZ 9999 r!Z 0 DUZrUZ1d5 Z 6 B * XML }]("w} 145 v !}k+HsZ 6 ;DUZrUZ1d5 v }V5,v6' XZ*;*w} XML }]`MD\am *9}]I&*;*?jw} XML }]`M,y]#=}]`MMw} XML }]` M,45ZJ(OXkP',"RC5XkZ#=}]`MMw} XML }]`MD DB2 ^FZ# Bm\aK+5*;*w} XML }]`M1gN&mb)5# m 20. XZ*;*w} XML }]`MD\am y]w} XML }]`M,5 P'(yP5TZ xs:string }]`M 146 pureXML 8O Zi4h*"vDi/.s,zI\v(|Gh*yZ price M color Dw}#Vvi /PzZ7(*|(Z CREATE INDEX odPD XML #=mo=#XML #=8> **w}!!D}]`M:g{ price *XG.xF},G4IT*w} priceindex ! q}V}]`M DECIMAL,g{ color tTGV{.,G4IT*w} colorindex ! q}]`M VARCHAR# XQUERY for $i in db2-fn:xmlcolumn(’COMPANY.PRODUCTDOCS’)/product[price > 5.00] return $i/name XQUERY for $i in db2-fn:xmlcolumn(’COMPANY.PRODUCTDOCS’)/product[@color = ’pink’] return $i/name CREATE INDEX priceindex on company(productdocs) GENERATE KEY USING XMLPATTERN ’/product/price’ AS DECIMAL(7,2) CREATE INDEX colorindex on company(productdocs) GENERATE KEY USING XMLPATTERN ’//@color’ AS SQL VARCHAR(80) #=9IT*V{.}]`M8(d{Z>}D ColorType Bf,dPV{.^F* 20 v Unicode V{#IZ CREATE INDEX od8(TV Zx;GV{*%;D VARCHAR $H,yT#=$HITKTrS 4 4Fcf"w }PD#=yJmDn$V{.yhDnsVZ}#ZK>}P,4*20 = 80,rK* colorindex !q VARCHAR(80)# g{#=;P*V{.}]`M8($H}5wK_-w}Momw}.dDX5:;vw},|(yZ XML }]D_-w}Momw}# SYSCAT.INDEXXMLPATTERNS ?Pm>;vyZ XML }]Dw}PD;v#=Sd# }]bVx73PDw} ISNN}]bVx"v CREATE INDEX M ALTER INDEX od# g{TZ`v}]Vx.dxPKVxDm4(w},G4Cw}2aZb)}]V x.dxPVx# sF XML PDw}+VPw}Ts`MCZsF#vsF_-w},;sFomw}# k XML PX*Dd{}]bTs P=vk XML P`X*Dw},4Z?w}M53zIDw}#b)w}m>* SYSCAT.INDEXES ?* SYSCAT.INDEXPARTITIONS ?;vw},|( XML 76w}M XML xrw}#XML 76w}Z SYSCAT.INDEXES.INDEXTYPE PT>* XPTH,x XML xrw}Z SYSCAT.INDEXES.INDEXTYPE PT>* XRGN# SYSCAT.INDEXPARTITIONS ?;Pm>kVxmPD}]Vx`X*Dw}Vx# XB4(yZ XML }]Dw} ZBPivB,+XB4( XML }]w}: v Z4P REORG INDEX r REORG INDEXES |nZd# v Z4P REORG TABLE |nZd# v 1z"v8(K REPLACE !nD IMPORT |n1# v 1i/"ek">}r|BYw"TCJmrw}"lb=w}TsjG*^' 1# 9C5w v k>z XML }]f"&\X*DyPw}<|,ZkX5w}`,Dmw}Ts P#b|(NN XML 76w}"XML xrw}MI\fZDyZ XML }]Dw }#;a;XB4(%vw}#g{XkXB4(w},G4a;pXB4(w} TsPDyPw}# v ZVxmO4P REORG TABLE |nZd,g{48( LOBGLOBDATA !n,G4+; a4( XML 76w}# 150 pureXML 8O CREATE INDEX CREATE INDEX odCZ(eT DB2 mDw}#ITT XML }]rX5}](e w}#CREATE INDEX od9CZ4(w}f6(MGC4rE/w8>}]4m_ Pw}D*}])# wC IT+Kod6k&CLrP,9IT(}9C/, SQL od4"vCod#|G; vI4Pod,v1 DYNAMICRULES KPP*TZLr|P'1E\/,`kCo d (SQLSTATE 42509)# (^ odZ(j65PDX(XkAY|(TBdP;n(^: v BPdP;n: – TZ(eKw}DmrGFD CONTROL X( – TZ(eKw}DmrGFD INDEX X( T0BPdP;n: – T}]bD IMPLICIT_SCHEMA (^(g{Cw}D~=rT=#={;fZ) – T#=D CREATEIN X((g{Cw}D#={}CVP#=) v DBADM (^ TQywY1m4(w}1;h*T=X(# o( CREATE INDEX index-name UNIQUE  , (1) ASC ON table-name ( column-name ) (2) DESC GF (3) BUSINESS_TIME WITHOUT OVERLAPS PARTITIONED NOT PARTITIONED * (4) IN tablespace-name * * SPECIFICATION ONLY  * , (5) INCLUDE ( column-name ) Z 6 B * XML }]("w} 151  * (6) xml-index-specification CLUSTER EXTEND USING index-extension-name , ( constant-expression ) PCTFREE 10 ** PCTFREE integer LEVEL2 PCTFREE integer ALLOW REVERSE SCANS ** MINPCTUSED integer DISALLOW REVERSE SCANS PAGE SPLIT SYMMETRIC * PAGE SPLIT HIGH LOW COLLECT STATISTICS SAMPLED DETAILED UNSAMPLED * COMPRESS NO YES ": 1 Z*O53P,table-name Xkj6*O}]bPD;vm#|;\j6}]4 m# 2 g{8(K nickname,G4 CREATE INDEX od+4(w}f6#ZbViv B,;\8( INCLUDE"xml-index-specification"CLUSTER"EXTEND USING"PCTFREE"MINPCTUSED"DISALLOW REVERSE SCANS"ALLOW REVERSE SCANS"PAGE SPLIT r COLLECT STATISTICS# 3 vZ8( UNIQUE 1E\8( BUSINESS_TIME WITHOUT OVERLAPS Sd# 4 vITVxmODGVxw}8( IN tablespace-name Sd# 5 vZ8( UNIQUE 1E\8( INCLUDE Sd# 6 g{8(K xml-index-specification,G4;\8( column-name DESC"INCLUDE r CLUSTER# xml-index-specification: (1) GENERATE KEY USING XMLPATTERN xmlpattern-clause xmltype-clause ": 1 IT9C8Co( GENERATE KEYS USING XMLPATTERN# 152 pureXML 8O xmlpattern-clause: ' pattern-expression ' namespace-declaration namespace-declaration:  DECLARE NAMESPACE namespace-prefix=namespace-uri ; DECLARE DEFAULT ELEMENT NAMESPACE namespace-uri pattern-expression:   / forward-axis xmlname-test // xmlkind-test / forward-axis xmlname-test function-step // forward-axis: child:: @ attribute:: descendant:: self:: descendant-or-self:: xmlname-test: xml-qname xml-wildcard xml-wildcard: * xml-nsprefix:* *:xml-ncname xmlkind-test: node() text() comment() processing instruction() Z 6 B * XML }]("w} 153 function-step: fn:upper-case ( ) , locale-name fn:exists ( xmlname-test ) xmltype-clause: AS data-type IGNORE INVALID VALUES REJECT INVALID VALUES data-type: sql-data-type sql-data-type: (1) SQL VARCHAR ( integer ) HASHED DOUBLE INTEGER INT (5,0) DECIMAL DEC ,0 NUMERIC (integer ) NUM ,integer DATE TIMESTAMP ": 1 g{Z XML q=ax&8(/}{(g fn:upper-case),G4\'VDw}}] `MI\GK&T>Dw}}]`MDS/#ITZ xmlpattern-clause DhvPl iP'w}}]`M# hv UNIQUE g{8(K ON table-name,G4 UNIQUE +h9mD=Pr|`P_P`,Dw }|5#Z|BPrekBPD SQL od)2+?F5)(;T# Z4P CREATE INDEX odZd2+li(;T#g{mPQ-|,_PX4| 5DP,G4;a4(w}# g{GT XML P4(w}(w}GT XML }]4(Dw}),G4(;TJC ZmPyPPD_P8( pattern-expression D5#TZQ*;*8( sql-data- type D?v5<+?F5)(;T#r**;*8(D sql-data-type I\am(x;GS<)"Q 4(DY1m"QywDY1m"fZZ10~qwPD_e/i/mr_Qyw DY1m#Xk9C SESSION 4^(QywY1mD{F#table-name ;\j6 ?Z? TZd`8(DX|V,b)5TZNN1dN45Xk G(;D#vIw*PmPDO;vn?8( BUSINESS_TIME WITHOUT OVER- LAPS#8( BUSINESS_TIME WITHOUTOVERLAPS 1,a+1dN BUSINESS_TIME DaxPM*&4(Vxw}#table-name Xkj6;vT}]Vx(eDm (SQLSTATE 42601)# g{CmGVxm,"R48( PARTITIONED M NOT PARTITIONED,G4a w*Vxw}44(w}(_PY?Dl#)#g{fZBPNNiv,G4+4 (GVxw}x;G4(Vxw}: v 8(K UNIQUE "Rw}|;|,yPmVx|P# v 4(;vUdw}# v yZ XML }](ew}# g{;vVxw}D(ekGVxw}D(e`,,2;aO*KVxw}G;v X4w}#PX|`j8E",kND>wbPDZ 166 3D:fr;b;Z# 156 pureXML 8O ^(*BPw}8( PARTITIONED X|V: v GVxmDw} (SQLSTATE 42601) v yZ XML }](eDw} (SQLSTATE 42613) v w}|;|,yPmVx|PD(;w} (SQLSTATE 42990) v Udw} (SQLSTATE 42997) ;\T_PQpkDStm(}g,MQT)DVxm4(Vxw} (SQLSTATE 55019)# TZVxw}Dw}Vx,&4BPfr47(gNECmUd: v g{;("w}DmG9C CREATE TABLE odD partition-tablespace- options INDEX IN Sd4(D,G4+ZC INDEX IN Sd8(DmUdP4 (w}Vx# v g{CZ4(;("w}DmD CREATE TABLE od48( partition-tablespace- options INDEX IN Sd,G4+Z|("w}D`&}]VxyZD,;mUd P4(w}VxDVxw}# CREATE INDEX odD IN Sd;'VVxw} (SQLSTATE 42601)#TZVx w},+vT CREATE TABLE odD tablespace-clauses INDEX IN Sd#g{ *w}|8( BUSINESS_TIME WITHOUT OVERLAPS,G4Vx|P;(;* |( BUSINESS_TIME 1dND*&C4(g=*m(eDyP}]VxDGVxw}#table-name Xkj6; vT}]Vx(eDm (SQLSTATE 42601)# g{;vGVxw}D(ekVxw}D(e`,,2;aO*KGVxw}G; vX4w}#PX|`j8E",kND>wbPDZ 166 3D:fr;b;Z# TZGVxw},&4BPfr47(gNECmUd: v g{z8( CREATE INDEX odD IN Sd,G4GVxw}+EkC IN S dy8(DmUdP# v g{48( CREATE INDEX odD IN Sd,G4+4UBPfr47(GV xw}DmUdEC: – g{;("w}DmG9C CREATE TABLE odD tablespace-clauses INDEX IN Sd4(D,G4GVxw}+EkC INDEX IN Sdy8(DmUd P# – g{;("w}Dm;G9C CREATE TABLE odD tablespace-clauses INDEX IN Sd4(D,G4+ZCmDZ;vISr`,}]VxDmUd P4(GVxw}#CmDZ;vISr`,}]VxMG4U6'f6E rD}]VxPmPDZ;vVx#Kb,CodDZ(j6;h*T1! mUd_P USE X(# IN tablespace-name 8(*ZdPkTVxm4(GVxw}DmUd#^(*GVxmODVxw} rw}8(KSd (SQLSTATE 42601)#4(m1,(ECZw}DmUdDf6 2G9C INDEX IN SdF(Df6# I tablespace-name 8(DmUdXkkmD}]mUdZ,;v}]bVxiP, "R4U\mVxmDd{mUdD==4\mUd;|XkG;vodDZ(j 6_P USE X(DmUd (SQLSTATE 42838)# Z 6 B * XML }]("w} 157 g{48( IN Sd,G4aZI CREATE TABLE odOD INDEX IN Sd8 (DmUdP4(w}#g{48( INDEX IN Sd,G49CmDZ;vISr `,}]VxDmUd#bG4U6'f6ErD}]VxPmPDZ;vVx# g{48( IN Sd,G4odDZ(j6;h*T1!mUd_P USE X(# SPECIFICATION ONLY 8>+9CKod44(&CZI nickname y}CD}]4mDw}f6#g{8 (K nickname,G4Xk8( SPECIFICATION ONLY (SQLSTATE 42601)#g{ 8(K table-name,G4;\8( SPECIFICATION ONLY (SQLSTATE 42601)# g{+w}f6&CZ(;w},G4 DB2 ;ai$6LmPDP5GqG(; D#g{6LP5;G(;D,G4T|,w}PDGFxPi/1I\a5X; }7D}]r_5Xms# TQ4(DY1mr_QywDY1m4(w}1,;\9CKSd (SQLSTATE 42995)# INCLUDE KX|V}k;vSd,CSd8(*7SA;iw}|PDd{P#9CKSd y|,DNNP4C4?F(;T#|,Db)PI\a(}vCJw}4Dx3 )i/DT\#b)PXkkC4?F(;TDP;, (SQLSTATE 42711)#18 (K INCLUDE 1,Xk8( UNIQUE (SQLSTATE 42613)#TZP}M\$H tTD^FJCZ(;|Mw}PDyPP# ;\TQ4(DY1mr_QywDY1m9CKSd (SQLSTATE 42995)# column-name j6|,Zw}P+;G(;w}|D;?VD;P#q-k(e(;w}| DP`,Dfr#ITZ column-name .s8(X|V ASC r DESC,+T 3r^NN0l# g{8(K nickname,r_Z XML PO(eKCw},G4;\T9C EXTEND USING (eDw}8( INCLUDE (SQLSTATE 42601)# xml-index-specification 8(gNSf"Z XML PPD XML D54zIw}|#g{P`vw}P,r _g{P;_P XML }]`M,G4;\8( xml-index-specification# KSdvJCZ XML P (SQLSTATE 429BS)# GENERATE KEY USING XMLPATTERN xmlpattern-clause 8(*T XML D5PDD)?V("w}#XML #=5G xmlpattern- clause zIDQ("w}D5#Zw}P;'VPm}]`MZc#g{ZcI xmlpattern-clause ^(,"RfZ;V8(ZcGPm}]`MD XML #=, G4;\TCPm}]`MZc("w}(TZ CREATE INDEX od+5X SQLSTATE 23526,xTZ INSERT M UPDATE od+5X SQLSTATE 23525)# xmlpattern-clause |,;vC4j6*("w}DZcD#=mo=#|I;vI!D namespace-declaration M;vXhD pattern-expression iI# namespace-declaration g{#=mo=|,^({,G4Xk8( namespace-declaration T( e{FUd0:#IT*G^({F(e1!{FUd# 158 pureXML 8O DECLARE NAMESPACE namespace-prefix=namespace-uri + namespace-prefix(|G;v NCName)3dA namespace-uri(| GV{.DV)#namespace-declaration IT|,`v namespace- prefix A namespace-uri D3d#namespace-prefix Z namespace- declaration PmPXkG(;D (SQLSTATE 10503)# DECLARE DEFAULT ELEMENT NAMESPACE namespace-uri *G^(*X{Fr`Myw1!{FUd URI#g{4yw1! {FUd,G4*XM`MDG^({F+;ZNN{FUd P#;\yw;v1!{FUd (SQLSTATE 10502)# pattern-expression 8( XML D5PQ("w}DZc#pattern-expression IT|,#= %dV{ (*)#|`FZ XQuery PD76mo=,+G|'V DB2 y 'VD XQuery oTDS/# /(}1\) +wv76mo==hVt*# //(+}1\) bG /descendant-or-self::node()/ Du4o(#g{z98(K UNIQUE,G4;\9C //(+}1\)# forward-axis child:: 8(OBDZcDSz#g{48(d{}ra,G4bG1 !iv# @ 8(OBDZcDtT#bG attribute:: Du4o(# attribute:: 8(OBDZcDtT# descendant:: 8(OBDZcDsz#g{98(K UNIQUE,G4;\9 C descendant::# self:: v8(OBDZc>m# descendant-or-self:: 8(OBDZc0dsz#g{98(K UNIQUE,G4;\ 9C descendant-or-self::# xmlname-test 9C^( XML {F(xml-qname)r(d{(xml-wildcard)48 (76PD=hDZc{# xml-ncname 4U XML 1.0 (eD XML {F#C{FP;\|,0EV {# xml-qname 8(^( XML {F(2F* QName),C{FIT_P=V q=: Z 6 B * XML }]("w} 159 v xml-nsprefix:xml-ncname,dP xml-nsprefix G;vC4j6 {FUdwCrD xml-ncname# v xml-ncname,|8>&C+1!{FUdw*~= xml- nsprefix 4&C# xml-wildcard + xml-qname 8(*;v(d{,|IT_PTB}Vq=: v *(%vGEV{),|8>NN xml-qname v xml-nsprefix:*,|8>8({FUdPDNN xml-ncname v *:xml-ncname,|8>NN{FUdwCrPDX( XML { F g{98(K UNIQUE,G4;\9C#=mo=OBD=h PD xml-wildcard# xmlkind-test 9Cb)!n48(zD#=kD)`MDZc`%d#*za )KBP!n: node() kNNZc`%d#g{98(K UNIQUE,G4;\9C node()# text() kNND>Zc`%d# comment() kNN"MZc`%d# processing-instruction() kNN&m8nZc`%d#g{98(K UNIQUE,G4; \9C processing-instruction()# function-step 9Cb)/}wCT8(_PXbtTDw}(}g,;xVs !4)#?v XMLPATTERN Sd;Jm;v/}=h#/}= hvI&CZ*XrtT#ZC/}=h0;\1SECNN xmlkind-test !n#^(Z XMLPATTERN Pd9CC/},Xk ;T>ZnsD=h#10,v'V fn:upper-case M fn:exists / }# "b,zIT*/}{8(m;P'{FUd4!z8(0: fn:, 9ITj+!T fn:# fn:upper-case ?FTs4N=f"w}5#fn:upper-case DZ;vN}G?F N},RXkGOBDn?mo=(“.”);Z~vN}GI !N},RGoT73#g{ fn:upper-case vVZ#=P,G 4v'V VARCHAR M VARCHAR HASHED w}`M# fn:exists li XML D5PGqfZ*XrtTn?#g{fZCn ?,G4K=J5X true#fn:exists N}G?FN},RXk 160 pureXML 8O G*XrtT#g{Zw}76P9CK/},G4Xk+w }`M(e* VARCHAR(1)# xmltype-clause AS data-type 8(Zf"Q("w}D5.0*+|G*;*D}]`M#b)5 +;*;*k8(Dw} SQL }]`MT&Dw} XML }]`M# m 22. `&Dw}}]`M w} XML }]`M w} SQL }]`M xs:string VARCHAR(integer)"VARCHAR M HASHED xs:double DOUBLE xs:int INTEGER xs:decimal DECIMAL xs:date DATE xs:dateTime TIMESTAMP TZ VARCHAR(integer) M VARCHAR HASHED,(}9C XQuery /} fn:string +5*;* xs:string 5#+ VARCHAR(integer) D$H tTw*;V?v3s! Dns5# m 23. 9C;,3s!DD5ZcDns$H 3s! D5ZcDns$H(4VZF) 4KB 817 8KB 1841 16KB 3889 32KB 7985 Z 6 B * XML }]("w} 161 XQuery oeCZV{.HO,dPD2?UqG#X*# bk SQL oe;,,dPD2?UqZHOZd;X*# VARCHAR HASHED 8( VARCHAR HASHED T&m*Nb$HDV{.( "w}#Q("w}DV{.D$H;\^F#DB2 +T {vV{.zI;v 8 VZD"Pzk#;\+9Cb) "PV{.Dw}CZ`Hi/#XQuery oeCZV{. `HHO,dPD2?UqG#X*#bk SQL oe; ,,dPD2?UqZHOZd;X*#V{."P#t XQuery `Hoe,+;#t SQL oe# DOUBLE 8(+}]`M DOUBLE CZ*}V5("w}#^^s D.xF`MM 64 ;{}Zw* DOUBLE 5f"1I \a*'+H#DOUBLE D5I\|(Xb}V5 NaN" INF"-INF"+0 M -0,49 SQL }]`M DOUBLE > m;'Vb)52GgK# INTEGER 8(+}]`M INTEGER CZ* XML 5("w}#k "b,XML #=}]`M xs:integer D56'JmsZ{ } SQL }]`MD56'#g{v=,v6'D5,G4 +5Xms#g{3v5{O xs:double DJcq=,+; {O xs:int DJcq=(g 3.5"3.0 r 3E1),G42a 5Xms# DECIMAL(integer, integer) 8(+}]`M DECIMAL CZ* XML 5("w}# DECIMAL `MxP=vN},4:precision M scale#Z ;vN} precision G{}#?,=xD5d6'S 1 = 31,G8(D\}V}#Z~vN} scale G{}#?,s ZrHZ 0,R!ZrHZ+H#scale 8(!}cR`} V}# ;aS.xF}ax&XO}V#g{.xFVt{V{ R_D}V}sZ!};},G4a5Xms#mb,g {!}cs_DP'}V}(+?V})sZ+H,G4 +5Xms# DATE 8(+}]`M DATE CZ* XML 5("w}#"b, TZ xs:date,XML #=}]`MJm56'sZk SQL }]`M`T&D DB2 pureXML xs:date }]`MD56 '#g{v=,v6'D5,G4+5Xms# TIMESTAMP 8(+}]`M TIMESTAMP CZ* XML 5("w}# "b,TZ xs:dateTime,XML #=}]`MJm5M! }k}+HD6'sZk SQL }]`M`T&D DB2 pureXML xs:dateTime }]`MD5M+H6'#g{v= ,v6'D5,G4+5Xms# 162 pureXML 8O IGNORE INVALID VALUES 8(+vTdJcq=TZ?jw} XML }]`M^'D XML # =5,"R CREATE INDEX od;a*Qf"D XML D5PDT &5("w}#1!ivB,+vT^'5#ZekM|BYwZ d,;aT^' XML #=5("w},+T;a+ XML D5ek mP#;azzmsr/f,bGr*8(b)}]`M;a;S* T XML #=5DGq*zO"w}6S3,T0Zw}6S3O9CDUdDn!YVHDP 5#Sw}6S3}%|.s,g{Z3O9CDUdDYVH!ZrHZYV. integer,G4"T+K3ODd`|k`Z3OD|xPO"#g{b)3OPc ;DUd,G4a4PO",">}dP;3#integer 5D6'G 0 = 99#ST \=f} T\#1RpK%bmx(1,+;Z4P|BM>}YwZdxPO"#g{; fZ%bmx(,G4Z4P|BM>}YwZd,|+;jG*1>},"R; xPO"#w}3FE"# SAMPLED 8(&mw}u?TU/)9Dw}3FE"1*9CDiy} v >} 1: T PROJECT m4(;v{* UNIQUE_NAM Dw}#4(w}D?D G*K7#mPu?Dn?{(PROJNAME);`,#w}u?+4}rEP# CREATE UNIQUE INDEX UNIQUE_NAM ON PROJECT(PROJNAME) v >} 2: T EMPLOYEE m4(;v{* JOB_BY_DPT Dw}#4U?v?E (WORKDEPT)P01D0F(JOB)44}rEPw}u?# CREATE INDEX JOB_BY_DPT ON EMPLOYEE (WORKDEPT, JOB) v >} 3: GF EMPLOYEE }CF* CURRENT_EMP D}]4m#Z4(KG F.s,MT CURRENT_EMP (eKw}#*w}|!qDPG WORKDEBT M JOB#4(;vhvKw}Dw}f6#(}Kf6,E/w+*@w}fZ0d w}|DZ]#hzKE",E/wMITDx|CJmD_T# Z 6 B * XML }]("w} 167 CREATE UNIQUE INDEX JOB_BY_DEPT ON EMPLOYEE (WORKDEPT, JOB) SPECIFICATION ONLY v >} 4: Ta9/`MP;C4(;v{* SPATIAL_INDEX D)9w}`M#w })9 GRID_EXTENSION PDhvC4,$ SPATIAL_INDEX#* GRID_EXTENSION x(Vf5T4(w}xqs!# CREATE INDEX SPATIAL_INDEX ON CUSTOMER (LOCATION) EXTEND USING (GRID_EXTENSION (x’000100100010001000400010’)) v >} 5:T{* TAB1 Dm4({* IDX1 Dw},"U/PX IDX1 w}Dy> w}3FE"# CREATE INDEX IDX1 ON TAB1 (col1) COLLECT STATISTICS v >} 6:T{* TAB1 Dm4({* IDX2 Dw},"U/PX IDX2 w}Dj8 w}3FE"# CREATE INDEX IDX2 ON TAB1 (col2) COLLECT DETAILED STATISTICS v >} 7:T{* TAB1 Dm4({* IDX3 Dw},"(}9CIy4U/PX IDX3 w}Dj8w}3FE"# CREATE INDEX IDX3 ON TAB1 (col3) COLLECT SAMPLED DETAILED STATISTICS v >} 8:T IDX_TBSP mUdP{* MYNUMBERDATA DVxm4({* A_IDX D(;w}# CREATE UNIQUE INDEX A_IDX ON MYNUMBERDATA (A) IN IDX_TBSP v >} 9:T IDX_TBSP mUdP{* MYNUMBERDATA DVxm4({* B_IDX DG(;w}# CREATE INDEX B_IDX ON MYNUMBERDATA (B) NOT PARTITIONED IN IDX_TBSP v >} 10:T{* COMPANYINFO Dm4(;v XML }]w},C COMPANYINFO mP|,;v{* COMPANYDOCS D XML P#XML P COMPANYDOCS P|,kTBZ]`FDs? XML D5: Laura Brown Finance COMPANYINFO mDC'(#h*9C01j64lw01E"#kTBZ]`F Dw}IT9lw'J|_# CREATE INDEX EMPINDEX ON COMPANYINFO(COMPANYDOCS) GENERATE KEY USING XMLPATTERN ’/company/emp/@id’ AS SQL DOUBLE v >} 11:TBw}k0;>}P4(Dw}Z_-OGH[D,;;}TBw}9C Gu4o(# CREATE INDEX EMPINDEX ON COMPANYINFO(COMPANYDOCS) GENERATE KEY USING XMLPATTERN ’/child::company/child::emp/attribute::id’ AS SQL DOUBLE v >} 12:T{* DOC DP4(w},v+i{Dw}4(* VARCHAR(100)#r *i{TZyPi.<&CG(;D,yTCw}2XkG(;D# 168 pureXML 8O CREATE UNIQUE INDEX MYDOCSIDX ON MYDOCS(DOC) GENERATE KEY USING XMLPATTERN ’/book/title’ AS SQL VARCHAR(100) v >} 13:T{* DOC DP4(w},"+BZEDw}4(* DOUBLE#K>} |,{FUdyw# CREATE INDEX MYDOCSIDX ON MYDOCS(DOC) GENERATE KEY USING XMLPATTERN ’declare namespace b="http://www.example.com/book/"; declare namespace c="http://acme.org/chapters"; /b:book/c:chapter/@number’ AS SQL DOUBLE v >} 14:Tm PROJECT 4({* IDXPROJEST D(;w},"|,P PRSTAFF TJmT@FD=y01E"xPvw}CJ# CREATE UNIQUE INDEX IDXPROJEST ON PROJECT (PROJNO) INCLUDE (PRSTAFF) kTyZ XML }]Dw}Dy>i/ yZ XML }]Dw}h*k*{C|GDi/%d#TB>}T>\;r;\{Cy Z XML }]Dw}Di/# IT9C XML }]w}Dy>i/ 9C`v;,=JDi/IT{C XML }]w}#>ZPT>KkIT9CDw}% dD XQuery =JD;)>}#Z%dw}.sxPi/# >} 1. "v`Hi/:iRj6* 42366 D01: XQUERY for $i in db2-fn:xmlcolumn(’COMPANY.COMPANYDOCS’)/company/emp[@id=’42366’] return $i CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/@id’ AS SQL VARCHAR(5) >} 2. 6'i/:iR=._Z 35000 D01: XQUERY for $i in db2-fn:xmlcolumn(’COMPANY.COMPANYDOCS’)/company/emp[@salary > 35000] return $i CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’//@salary’ AS SQL DECIMAL(10,2) >} 3. "v|,“r”(OR)Di/:iRFq?rP!?D01: XQUERY for $i in db2-fn:xmlcolumn(’COMPANY.COMPANYDOCS’)/company/emp[dept/text()=’Finance’ or dept/text()=’Marketing’] return $i CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/dept/text()’ AS SQL VARCHAR(30) >} 4. ,;vw}ITzc;,i/: iRj6* 31201 D01: XQUERY for $i in db2-fn:xmlcolumn(’COMPANY.COMPANYDOCS’)/company/emp[@id=’31201’] return $i Z 6 B * XML }]("w} 169 iRj6* K55 D?E: XQUERY for $i in db2-fn:xmlcolumn(’COMPANY.COMPANYDOCS’)/company/emp/dept[@id=’K55’] return $i CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’//@id’ AS SQL VARCHAR(25) >} 5. i/=JIT|,76:iRz[?PU Murphy D01: XQUERY for $i in db2-fn:xmlcolumn(’COMPANY.COMPANYDOCS’)/company/emp[name/last=’Murphy’ and dept/text()=’Sales’] return $i CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/name/last’ AS SQL VARCHAR(100) CREATE INDEX deptindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/dept/text()’ AS SQL VARCHAR(30) >} 6. i/Zd70Vc|,:i/IT9Cw}ZD5cNa9D;,6p4P “k”(AND)Kc#i/9IT9Cw}47(D)SZctZ,;fz,TxP` &D}K# iR=.HZ 60000 D.01yZD+>#Z“PX* XML }]("w}DEv”w bDy> XML ,NP,Company1 M Company2 <{Ou~# XQUERY for $i in db2-fn:xmlcolumn(’COMPANY.COMPANYDOCS’)/company[emp/@salary=60000 and emp/@gender=’Female’] return $i iR=.HZ 60000 D.01#v Company1 PD Laura Brown {Ou~# XQUERY for $i in db2-fn:xmlcolumn(’COMPANY.COMPANYDOCS’)/company/emp[@salary=60000 and @gender=’Female’] return $i CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/@salary’ AS DECIMAL(10,2) CREATE INDEX genderindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/@gender’ AS SQL VARCHAR(10) >} 7. i/IT9C descendant-or-self a(//)"9Cw},+0aGi/=JD^ FsZr_AYHZw}#=D^F# iR?Ej6* K55 D01: XQUERY for $i in db2-fn:xmlcolumn(’COMPANY.COMPANYDOCS’)/company//emp[.//dept//@id=’K55’ ] return $i CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’//emp//@id’ AS SQL VARCHAR(25) >} 8. TZ`,/:(MDC)m,i/I9C MDC iw}MyZ XML }]Dw }#Y(Q4(xP XML PD MDC m,"RCm+ WORKDEPT Cw,# CREATE TABLE employee (empno char(6), workdept char(3), doc xml) ORGANIZE BY DIMENSIONS (workdept) 170 pureXML 8O Y(9CTB CREATE INDEX od(eDP DOC _PyZ XML }]Dw}: CREATE INDEX hdate on employee(doc) GENERATE KEY USING XMLPATTERN ’//hirdate’AS SQL DATE COLLECT STATISTICS TBi/IZdf!=8P9C WORKDEPT Diw}M DOC DyZ XML }] (hdate)Dw}: SELECT COUNT (*) FROM y.employee y WHERE workdept=’A00’ AND XMLEXISTS(’$p/employee[hiredata > "1964-01-01"] PASSING y.doc as "p") ;\9C XML }]w}Dy>i/ Z3)ivBi/;\9C XML }]w}#>ZPP>K;\9CyT>D$Zw} D XQuery =JD;)>}# >} 1. Zi/9Cw}.0,i/yksD}]`MXkk$ZD}]`M%d#Z K>}P,i/ksV{.N=D01j6,+("Dj6w}*}V: XQUERY for $i in db2-fn:xmlcolumn(’COMPANY.COMPANYDOCS’)/company/emp[@id=’31664’] return $i CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/@id’ AS SQL DOUBLE >} 2. CZ4(w}D XML #=mo=D^FI\Hi/=JD^F|`#ZK> }P,i/;\9Cw},r*i/,1lw?Ej6M01j6,+w};|,0 1j6: XQUERY for $i in db2-fn:xmlcolumn(’COMPANY.COMPANYDOCS’)//@id return $i CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’/company/emp/@id’ AS SQL VARCHAR(5) TBi/lw01j6* 31201 r?Ej6* K55 D01#IZj6I\G01j6 r?Ej6,+w};|,?Ej6,yT;\44(DGy9Cw}# XQUERY for $i in db2-fn:xmlcolumn(’COMPANY.COMPANYDOCS’)//emp[.//@id=’31201’ or .//@id=’K55’] return $i CREATE INDEX empindex on company(companydocs) GENERATE KEY USING XMLPATTERN ’//dept//@id’ AS SQL VARCHAR(5) TyZ XML }]Dw}D^F ("yZ XML }]Dw}fZ;)^F,|(}]`M'V^F""P6p^F" XML Pm*X^FMw}9u^F# "P6p Z&m XML PM`X*Dw}Zd,+^FT;)"P6pD'V#Bm8(' VD"P6p# m 24. xPAY;v XML PD4VxmD\'V"P6p |n "P6p Gq\'V REORG INDEXES ALL FOR TABLE |nSd:ALLOW [NO | READ | WRITE] ACCESS G# Z 6 B * XML }]("w} 171 m 24. xPAY;v XML PD4VxmD\'V"P6p (x) |n "P6p Gq\'V REORG TABLE |nSd:ALLOW [READ | NO] ACCESS G#yZ XML }]Dw}I \fZ# REORG TABLE INPLACE(mAY fZ;vyZ XML }]Dw }) |nSd:ALLOW [READ | WRITE] ACCESS q# REORG TABLE RECLAIM EXTENTS |nSd:ALLOW [NO | READ | WRITE] ACCESS G# m 25. xP4Vxw}T0AY;v XML PDVxmD\'V"P6p |n "P6p Gq\'V REORG INDEX(TZyZ XML }]D4Vxw}) |nSd:ALLOW [NO | READ | WRITE] ACCESS G# REORG INDEXES ALL FOR TABLE CLEANUP|RECLAIM EXTENTS |nSd:ALLOW [NO | READ | WRITE] ACCESS G# REORG INDEXES ALL FOR TABLE REBUILD1 |nSd:ALLOW [READ | WRITE] ACCESS q# REORG TABLE |nSd:ALLOW NO ACCESS (TZVxm,(;\'VD CJG ALLOW NO ACCESS) G# REORG TABLE INPLACE |nSd:ALLOW [NO | READ | WRITE] ACCESS q # T Z V x m , ; ' V INPLACE N}# REORG TABLE RECLAIM EXTENTS |nSd:ALLOW [NO | READ | WRITE] ACCESS G# ": 1. 1!P*aX(w}#g{z;8( REBUILD Sd,G4aX(w}# m 26. xPVxw}T0 XML PDVxmD\'V"P6p |n "P6p Gq\'V REORG INDEXES ALL FOR TABLE |nSd:ALLOW NO ACCESS G# REORG INDEXES ALL FOR TABLE CLEANUP|RECLAIM EXTENTS |nSd:ALLOW [READ | WRITE] ACCESS G# REORG INDEXES ALL FOR TABLE REBUILD ON DATA PARTITION1 |nSd:ALLOW [READ | WRITE] ACCESS G# REORG INDEXES ALL FOR TABLE REBUILD1 |nSd:ALLOW [READ | WRITE] ACCESS q# REORG TABLE |nSd:ALLOW NO ACCESS (TZ}]Vxm,(;\' VDCJG ALLOW NO ACCESS) G# REORG TABLE INPLACE |nSd:ALLOW [NO | READ | WRITE] ACCESS q#TZ}]Vxm,;'V INPLACE N}# REORG TABLE RECLAIM EXTENTS |nSd:ALLOW [NO | READ | WRITE] ACCESS G# 172 pureXML 8O ": 1. 1!P*aX(w}#g{z;8( REBUILD Sd,G4aX(w}# PXSdM!nDE",kND CREATE INDEX odM REORG INDEX/TABLE |n# TZ`,/: (MDC) mMek1d/: (ITC) m,;'V9C ALLOW WRITE ACCESS xP*zw}XBi/(X()# XML Pm*X ;\TPm}]`MZc("w}#g{ZcI xmlpattern-clause ^(,"RfZ ;v8(ZcGPm}]`MD XML #=,G4;\TCZc("w}#TPm }]`MZc"v CREATE INDEX od+5Xms(SQLSTATE 23526"SQLCODE -20306)#"v INSERT M UPDATE od2+5Xms(SQLSTATE 23525"SQLCODE -20305)# UNIQUE XML }]w} ZVx}]b73P,xP;vr`v XML PDmfZTBfr: v xPV<|Dm;\PyZ XML }]D(;w}# v v'VZ%Vx}]bPT;PV<|Dm9CyZ XML }]D(;w}# v g{mfZyZ XML }]D(;w},G4;\DdCm4mSV<|# TZVxm,;'VyZ XML }]D(;Vxw}#g{"T4(K`w},+ aU=ms{" SQL20303N (SQLSTATE=42990)# T XML P4(w}2*qXT>z XML }]f"wh(DyP^F# #{ XML ("w}Jb g{Z* XML }]("w}1v=Jb,BPdP;vJbbv=8I\JC# SQL20305N M SQL20306N ms{"DJb7( b)ms{"GZ;\T XML Zc5("w}1"vD#SQL20305N {"I INSERT M UPDATE odT0 IMPORT M LOAD 5CLr"v#SQL20306N {"I CRE- ATE INDEX odkTndDy>m"v# b){"advmsD-rk#Z|nP&mwP"v ? SQL20305 r ? SQL20306,T iR`&-rkD5wMC'l&#zID XQuery odadvA db2diag U>D~, TcozzRv'\D XML Zc5# g{ SQL20305N I LOAD 5CLr"v,G4;a+zID XQuery od(CZR v'\Zc5)4A db2diag U>D~#*zIb) XQuery od,XkT40kD '\PKP IMPORT 5CLr#kND DB2 E"PDZD“0k XML }]”M“bv 0k XML }]1"zD("w}ms”,TKbd{{"# g{ SQL20305N I INSERT r UPDATE od"v,kND“oO INSERT r UPDATE od"vD SQL20305N {”#g{ SQL20306N I CREATE INDEX od "v,kND“oO CREATE INDEX odTQndDm"vD SQL20306N {"”# Z 6 B * XML }]("w} 173 oO INSERT r UPDATE od"vD SQL20305N {" *7(vV SQL20305N ms{"D-r,kNDP“SQL20305N M SQL20306N ms {"DJb7(”,;sq-BP=h: }L 1. 7(w}{Mw} XML #=Sd a. (}9Cms{"PD index-id "vTBi/,Tq!w}{(index-name,index- schema): SELECT INDNAME,INDSCHEMA FROM SYSCAT.INDEXES WHERE IID = index-id AND TABSCHEMA =’schema’ AND TABNAME =’table-name’ b. (}"vTBi/,9C index-name M index-schema 4q! SYSCAT.INDEXES PDw}}]`MM XML #=: SELECT DATATYPE, PATTERN FROM SYSCAT.INDEXXMLPATTERNS WHERE INDSCHEMA = ’index-schema’ AND INDNAME = ’index-name’ 2. *ZdkD5PiR'\DZc5,kZ db2diag U>D~PQwV{. SQL20305N "k-rk`E%d#@]-rk,zaR=;i8>E"MzID XQuery od, I9C|G4RvD5PD~Div,+C5D pD~PzID XQuery od,"+ XQuery PDm{f;*B 4(Dm{# 5. 4P XQuery odTlwj{D5M|,D~PDdvgBy>(|,Ymq=|D): 2007-03-06-12.02.08.116046-480 I4436A1141 6p:/f PID : 1544348 TID : 1801 PROC : db2sysc INSTANCE: adua NODE : 000 DB : ADTEST APPHDL : 0-18 APPID: *LOCAL.adua.070306200203 AUTHID : ADUA EDUID : 1801 EDUNAME: db2agent (ADTEST) /}:DB2 UDB,XML f"wMw}\mw, xmlsIkaProcessErrorMsg,=b:651 {":ZRC=0x80A50411=-2136669167=XMS_XML_IX_INSERT_UPDATE_ERROR “ekr|B XML w}1"z XML Zc5ms” DATA #1:V{.,36 VZ SQL zk:SQL20305N;-rk:5 DATA #2:V{.,321 VZ *ZD5PiR {$i} {$i/*:root/*:x/text()/..} ; *i/'\Zc5,k4PBPYw: 1. 4(|,-D~PzID XQuery od,"+ XQuery PDm{f;*B m{: xquery for $i in db2-fn:xmlcolumn("ADUA.T2.X")[/*:root/*:x/text()="hello world"] return {$i} {$i/*:root/*:x/text()/..} ; 4. TBm4P XQuery od#i/odDa{gBy>(|,Ymq=|D): Z 6 B * XML }]("w} 175 The beginning of the documenthello world hello world |}TBms: I|DD5T9 *X|,+I&X*;* DOUBLE }]`MD}V5: INSERT INTO t1 VALUES ( XMLPARSE (DOCUMENT ’The beginning of the document123’ STRIP WHITESPACE)) oO CREATE INDEX odTndDm"vD SQL20306N {" *7(vV SQL20306N ms{"D-r,kNDP“SQL20305N M SQL20306N ms {"DJb7(”,;sq-BP=h: }L 1. *Zf"DD5PiR'\DZc5,kZ db2diag U>D~PQwV{. SQL20306N "k-rk`E%d# @]-rk,zaR=;i8>E"MzID XQuery od,I9C|G4RvD5PD~Div,+C5Dp}:CREATE INDEX '\ ZK>}P,Qf"D5PD^(D>5,vw} XML #=PD VARCHAR(4) $H This is the beginning of the document test rld12345678901234567890123412345678901234567890123 45678901234567890123456789009876543211234567890098765 43211234456778809876543211234567890455 176 pureXML 8O ’ strip whitespace)) DB20000I QI&jI SQL |n# CREATE INDEX i1 ON t(x) GENERATE KEY USING XMLPATTERN ’/x/y//text()’ AS SQL VARCHAR(4) DB21034E C|n;1w SQL od4&m,r*|G^'D“|nP&mw”|n#Z SQL &m Zd,|5X: SQL20306N IZZ+ XML 5ek=w}P1lb=ms,yT^(4(;v XML PD w}#-rk*“1”# TZ XML #=D`X-rk,XML j6*“*N”,XML #=}]`M*“*N”#SQLSTATE=23526 db2diag U>D~PDdvgBy>(|,Ymq=|D): 2007-03-06-12.08.48.437571-480 I10148A1082 6p:/f PID : 1544348 TID : 1801 PROC : db2sysc INSTANCE: adua NODE : 000 DB : ADTEST APPHDL : 0-30 APPID: *LOCAL.adua.070306200844 AUTHID : ADUA EDUID : 1801 EDUNAME: db2agent (ADTEST) /}:DB2 UDB,XML f"wMw}\mw, xmlsIkaProcessErrorMsg,=b:361 {":ZRC=0x80A50412=-2136669166=XMS_XML_CRIX_ERROR “4( XML w}1"z XML Zc5ms” DATA #1:V{.,36 VZ SQL zk:SQL20306N;-rk:1 DATA #2:V{.,72 VZ *ZD5PiR {$doc} {$doc/*:x/*:y/*:z/text()/..} ; i/odDa{gBy>(|,Ymq=|D): This is the beginning of the document test rld12345678901234567890123412345678901234567890123 45678901234567890123456789009876543211234567890098765 43211234456778809876543211234567890455 rld12345678901234567890123412345678901234567890123 45678901234567890123456789009876543211234567890098765 43211234456778809876543211234567890455 |}TBms: I|D CREATE INDEX XML #=Ta_ns VARCHAR $H: Z 6 B * XML }]("w} 177 CREATE INDEX i1 ON t(x) GENERATE KEY USING XMLPATTERN ’/x/y//text()’ AS SQL VARCHAR(200) 178 pureXML 8O Z 7 B |B XML }] *|B XML PPD}],I9C SQL UPDATE od#k*|BX(P1,I|( WHERE Sd# +f;{vP5#XML PDdkXkGq=: Christine Haas 12 Topgrove Toronto Ontario N9Y-8G9 905-555-5238 416-555-2934 >}:Z JDBC &CLrP,T~xF}]DN=A!D~ c7.xml PD XML }], "9C|4|B XML PPD}]: PreparedStatement updateStmt = null; String sqls = null; int cid = 1004; sqls = "UPDATE MyCustomer SET Info=? WHERE Cid=?"; updateStmt = conn.prepareStatement(sqls); updateStmt.setInt(1, cid); File file = new File("c7.xml"); updateStmt.setBinaryStream(2, new FileInputStream(file), (int)file.length()); updateStmt.executeUpdate(); >}:Z6k= C &CLrP,(}~xF XML wd?|B XML PPD}]: EXEC SQL BEGIN DECLARE SECTION; sqlint64 cid; SQL TYPE IS XML AS BLOB (10K) xml_hostvar; EXEC SQL END DECLARE SECTION; ... cid=1004; /* Read data from file c7.xml into xml_hostvar */ ... EXEC SQL UPDATE MyCustomer SET Info=:xml_hostvar WHERE Cid=:cid; © Copyright IBM Corp. 2006, 2013 179 Zb)>}P, *XZ Cid tTD5}C2f"Z CID X5PP#r K,UPDATE odPD WHERE Sd9CX5P CID 48(*|BDP#g{vZ XML D5ZR=CZ7(!qD)P4xP|BD5,G4IT9C XMLEXISTS = J#}g,IT4gBy>+O;v6k= C &CLr>}PD UPDATE od|D *9C XMLEXISTS: EXEC SQL UPDATE MyCustomer SET Info=:xml_hostvar WHERE XMLEXISTS (’$doc/customerinfo[@Cid = $c]’ passing INFO as "doc", cast(:cid as integer) as "c"); >}:TB>}|B MYCUSTOMER mPDVP XML }]#SQL UPDATE oda wCZ MYCUSTOMER mD;P"+CP INFO PPDD5f;*d;mo=^Ds DD5_-lU: UPDATE MyCustomer SET info = XMLQUERY( ’transform copy $newinfo := $info modify do insert Current as last into $newinfo/customerinfo return $newinfo’ passing info as "info") WHERE cid = 1004 Zd;mo=P9C|BYw XkZd;mo=D modify SdP9C DB2 XQuery |Bmo=#|Bmo=aw CZd;mo= copy Sd4(D4FZc# BPmo=G|Bmo=: v >}mo= v ekmo= v X|{mo= v f;mo= v d return Sd|,|Bmo=D FLWOR mo= v d then r else Sd|,|Bmo=Du~mo= v C:Et*D=vr|`|Bmo=,dPyPYw}""Mr&m 8nZc# 2. 9C before"after"as first r as last .`DErX|VDekYw# 3. 48(X|V value of Df;Yw# 4. f;Yw,dP8(KX|V value of "R?jZc**XZc# 5. yP>}Yw# &C|DYwD3r&7#;5P`v|D+zI7(Da{#PX|BYwD4P 3rgN#$;5P`v|DzI7(a{D>},kND:>};PDns;v XQuery mo=# ^' XQuery |BYw &md;mo=Zd,g{vVBPdP;Viv,G4 DB2 XQuery a5Xms: v T,;Zc&CK=vr|`X|{Yw# v T,;Zc&CK9CX|V value of D=vr|`f;Yw# v T,;Zc&CK49CX|V value of D=vr|`f;Yw# v d;mo=Da{"GP' XDM 5}# |,D*XD=vtT,{MG;v^' XDM 5}D>}# v XDM 5}|,;;BD{FUds(# BfG;;BD{FUds(D>}: – tTZcD QName PD{FUds(kd8*XZcPD{FUds(;;B# – _P,;8zD=vtTZcPD{FUds(`%;;B# >} ZTB>}P,d;mo=D copy Sd+d? $product s(A*XZcD1>,x d;mo=D modify Sd9C=v|Bmo=4|D4FZc: xquery transform copy $product := db2-fn:sqlquery( "select description from product where pid=’100-100-01’")/product modify( do replace value of $product/description/price with 349.95, do insert Available as last into $product ) return $product Z 7 B |B XML }] 181 TB>}Z SQL UPDATE odP9C XQuery d;mo=4^D CUSTOMER mP D XML }]#SQL UPDATE odawCZ CUSTOMER mD3P#d;mo=ay ]CPD INFO P4( XML D5D1>,"+ status *XmSAD51># UPDATE oda+CP INFO PPDD5f;*d;mo=^DsDD51>: UPDATE customer SET info = xmlquery( ’transform copy $newinfo := $info modify do insert Current as last into $newinfo/customerinfo return $newinfo’ passing info as "info") WHERE cid = 1003 TB>}9C DB2 SAMPLE }]bPD CUSTOMER m#Z CUSTOMER mP,XML P INFO |,M'X7Mg0E"# ZTB>}P,SQL SELECT odawCZ CUSTOMER mD3P#d;mo=D copy Sday]P INFO 4( XML D5D1>#>}mo=a>}D51>PDX 7E"MG$wg0Ek#return a9C CUSTOMER mD- {data($d/customerinfo/@Cid)} {$mycust/customerinfo/*} {data($d/customerinfo/addr/@country)} ’ passing INFO as "d") FROM CUSTOMER WHERE CID = 1003 T SAMPLE }]bKP1,Cod+5XTBa{: 1003 Robert Shoemaker 905-555-7258 Canada ZTB>}P,XQuery mo=a5w|BYwD3rgN#$;5P`v|D+zI7 (Da{#ekmo=aZ phone *XsmS status *X,xf;mo=a+ phone *Xf;* email *X: xquery let $email := jnoodle@my-email.com let $status := current return transform copy $mycust := db2-fn:sqlquery(’select info from customer where cid = 1002’) modify ( do replace $mycust/customerinfo/phone with $email, do insert $status after $mycust/customerinfo/phone[@type = "work"] ) return $mycust Z modify SdP,f;mo=Zekmo=.0#+G,|B4FZcrP $mycust 1,aZf;|BYw.04Pek|BYw,T7#zI7(Da{#T SAMPLE } ]bKP1,Cmo=+5XTBa{: 182 pureXML 8O Jim Noodle 25 EastCreek Markham Ontario N9C 3T6 jnoodle@my-email.com current g{H4Pf;Yw,G4 phone *X;aZZcrPP,xCZZ phone *Xse k status *XDYw;PNNbe# PX|BYwD3rDE",kNDZ 180 3D:&m XQuery |BYw;# 9Cd{mPDE"|B XML D5 I9Cd{}]bPPD}]4|B XML D5#}g,g{3vm|,|BsDM' E",G4I9C SQL/XML odM XQuery mo=4|B XML D5PDM'E"# 9CTB SQL od44(|,BDM'g0EkDy>m# CREATE TABLE NewPhones ( CID BIGINT NOT NULL PRIMARY KEY, PhoneNo VARCHAR(20), Type VARCHAR(10))~ INSERT INTO NewPhones (CID, PhoneNo, Type) VALUES (1001, ’111-222-3333’, ’cell’ )~ INSERT INTO NewPhones (CID, PhoneNo, Type) VALUES (1002, ’222-555-1111’, ’home’ )~ INSERT INTO NewPhones (CID, PhoneNo, Type) VALUES (1003, ’333-444-2222’, ’home’ )~ 9CTB SQL od4|B CUSTOMER mPDM'g0Ek#Cod9C XMLQUERY /}M XQuery mo=,Cmo=I FLWOR mo=M|,ekmo= Dd;mo=iI# UPDATE CUSTOMER SET INFO = XMLQUERY( ’let $myphone := db2-fn:sqlquery(’’SELECT XMLELEMENT(Name "phone", XMLATTRIBUTES( NewPhones.Type as "type" ), NewPhones.PhoneNo ) FROM NewPhones WHERE CID = parameter(1)’’, $mycid ) return transform copy $mycust := $d modify do insert $myphone after $mycust/customerinfo/phone[last()] return $mycust’ passing INFO as "d", 1002 as "mycid" ) WHERE CID = 1002~ XMLQUERY /}a4P XQuery mo=,Cmo=a+ phone *XZcmSAM' E""+^DsDE"5XA UPDATE od#Z XQuery FLWOR mo=D let S dP,db2-fn:sqlquery /}a4P SQL fullselect od#+i/a9CS XMLQUERY +]A XQuery mo=DM'j6# FULLSELECT odXk5X XML }]`M#*Ky] SELECT od5XD PHONENO M TYPE }]4( XML }]`M,XMLELEMENT M XMLATTRIBUTES /}y]a)D}]4(K phone *XZc# ZK>}P,let SdPD db2-fn:sqlquery 4PD+i/a4(TB phone *XZc# Z 7 B |B XML }] 183 222-555-1111 KPTB SQL SELECT odTi4M'E",VZ,1|,$wg0EkMR%g0 Ek# SELECT INFO FROM CUSTOMER WHERE CID = 1002~ SmP>} XML }] *>}|, XML D5DP,I9C DELETE SQL od#g{*>}X(P,G4| ( WHERE Sd# ITy] XML PPD58(*>}DP#*iR XML D5ZD5,h*9C XQuery mo=#I9C XMLEXISTS =J8( XQuery mo=,|Jmz8( XQuery mo ="7(Cmo=Gq}P# XML PXk*Ur|,q=} XML D5 +;>}P,G49CxP SET NULL D UPDATE SQL od,T+PhC*U(g {P(e*IU)#*>}VP XML D5PtTr*X.`DTs,k9C UPDATE SQL od0 XQuery |Bmo=#XQuery |Bmo=I|DVP XML D5D1># ;s,UPDATE oda+ XQuery |Bmo=5XDQ|D1>&CZ8(PD XML P# BP>}5wKgNS XML PP>} XML }]#b)>}9Cm MyCustomer(| Gy> Customer mD1>),"Y( MyCustomer PQndyP Customer }]# >}:>}m MyCustomer P Cid P5* 1002 DP# DELETE FROM MyCustomer WHERE Cid=1002 >}:>}m MyCustomer P city *XD5* Markham DP#Kod>}M'j6 * 1002 DP# DELETE FROM MyCustomer WHERE XMLEXISTS (’$d//addr[city="Markham"]’ passing INFO as "d") >}:>} MyCustomer P city *XD5* Markham DPPD XML D5,+#t CP#Kod&>}M'j6* 1002 DPD Info PPD XML }]# UPDATE MyCustomer SET Info = NULL WHERE XMLEXISTS (’$d//addr[city="Markham"]’ passing INFO as "d") >}:TB>}>} MyCustomer mPVP XML }]ZDg0E"#SQL UPDATE odawCZ MyCustomer mD3P#XQuery d;mo=(}CPD INFO P4( XML D5D1>,"9C XQuery >}mo=}%D51>PD$wg0Ek# UPDATE oda+CP INFO PPDD5f;*d;mo=^DsDD51>: UPDATE MyCustomer SET info = XMLQUERY( ’transform copy $newinfo := $info modify do delete ($newinfo/customerinfo/phone[@type="work"]) return $newinfo’ passing info as "info") WHERE cid = 1004 184 pureXML 8O Z 8 B XML #=f"b XML #=f"b (XSR) GCZ&m XML PPf"D XML 5}D5DyP XML $~Df"b#XSR DC>G'Vz4P@5Zb) XML $~DNq# XML 5}D5I\}CK8r`X* XML #="DTD rd{b?5eD3;J4j 6(URI)#Xk9CK URI 4&m5}D5# DB2 }]b539C XSR \mTb Vb?}CD XML $~D@5X5,x;h*|D URI ;C}C# g{;PbVzF4f"`X* XML #="DTD rb?5e,G4b?J4Z}] bh*1I\^(CJ,r_I\;|D,+4,1%"Tf"Z}]bZDQi$ Mx"MD XML D5DXh|D#9C XSR 9IT\biRb?D5yhDd{* zT0I\TT\zzD0l# ?v}]b<|,;v;Z}]b?}I9CD=v XML #=D5iI: “PO.xsd”M“address.xsd”,b=vD5X C:\TEMP P#C'*C|,=?V D SQL {F“user1.POschema”"aK#=#XML #=P;vk|X*DtTD~,F * schemaProp.xml#KtTD~2f"Z,;v>X C:\TEMP ?}45,K=h;GI!D,r* XML 186 pureXML 8O # = I = v XML # = D 5 i I , b = v D 5 < X k Q - " a # 9 C XSR_ADDSCHEMADOC f"}L4mSd{ XML #=D5#TB>}T>gN +X7D#=9lmSA XSR Ts: CALL SYSPROC.XSR_ADDSCHEMADOC (’user1’, ’POschema’, ’http://myPOschema/address’, :content_host_var, NULL) 3. (}wC SYSPROC.XSR_COMPLETE f"}L4jI"a#ZTB>}P,ns ;vN}8>;a+ XML #=CZVb(g{5* 1,G48>|+CZVb): CALL SYSPROC.XSR_COMPLETE (’user1’, ’POschema’, :schemaproperty_host_var, 0) X( _P DBADM (^DNNC'}T>gN+X7D#=9lmSAf" w: ADD XMLSCHEMA DOCUMENT TO user1.POschema ADD ’http://myPOschema/address’ FROM ’file://c:/TEMP/address.xsd’ 3. (}"v COMPLETE XMLSCHEMA |n4jI"a: COMPLETE XMLSCHEMA user1.POschema WITH ’file://c:TEMP/schemaProp.xml’ Z 8 B XML #=f"b 187 X( _P DBADM (^DNNC'}4FKdZ]D XML #=#K=(;\CZk DB2 for Linux, UNIX, and WindowsD,S# XkH+'Vb)=(Df"}L20Z DB2 }]b~qwO,;sE\wCb)= (# >}:"a XML #=:TB>}5wgN9C registerDB2XmlSchema "9CSdk wPA!D%v XML #=D5 (customer.xsd) Z DB2 P"a XML #=#Q"aD #=D SQL #={F* SYSXSR#4"ad{tT# public static void registerSchema( Connection con, String schemaName) throws SQLException { // Define the registerDB2XmlSchema parameters String[] xmlSchemaNameQualifiers = new String[1]; String[] xmlSchemaNames = new String[1]; String[] xmlSchemaLocations = new String[1]; InputStream[] xmlSchemaDocuments = new InputStream[1]; int[] xmlSchemaDocumentsLengths = new int[1]; java.io.InputStream[] xmlSchemaDocumentsProperties = new InputStream[1]; int[] xmlSchemaDocumentsPropertiesLengths = new int[1]; InputStream xmlSchemaProperties; int xmlSchemaPropertiesLength; //Set the parameter values xmlSchemaLocations[0] = ""; FileInputStream fi = null; xmlSchemaNameQualifiers[0] = "SYSXSR"; xmlSchemaNames[0] = schemaName; try { fi = new FileInputStream("customer.xsd"); xmlSchemaDocuments[0] = new BufferedInputStream(fi); } catch (FileNotFoundException e) { 188 pureXML 8O e.printStackTrace(); } try { xmlSchemaDocumentsLengths[0] = (int) fi.getChannel().size(); System.out.println(xmlSchemaDocumentsLengths[0]); } catch (IOException e1) { e1.printStackTrace(); } xmlSchemaDocumentsProperties[0] = null; xmlSchemaDocumentsPropertiesLengths[0] = 0; xmlSchemaProperties = null; xmlSchemaPropertiesLength = 0; DB2Connection ds = (DB2Connection) con; // Invoke registerDB2XmlSchema ds.registerDB2XmlSchema( xmlSchemaNameQualifiers, xmlSchemaNames, xmlSchemaLocations, xmlSchemaDocuments, xmlSchemaDocumentsLengths, xmlSchemaDocumentsProperties, xmlSchemaDocumentsPropertiesLengths, xmlSchemaProperties, xmlSchemaPropertiesLength, false); } >}:}% XML #=:TB>}5wgN9C deregisterDB2XmlObject S DB2 P} % XML #=#Q"aD#=D SQL #={F* SYSXSR# public static void deregisterSchema( Connection con, String schemaName) throws SQLException { // Define and assign values to the deregisterDB2XmlObject parameters String xmlSchemaNameQualifier = "SYSXSR"; String xmlSchemaName = schemaName; DB2Connection ds = (DB2Connection) con; // Invoke deregisterDB2XmlObject ds.deregisterDB2XmlObject( xmlSchemaNameQualifier, xmlSchemaName); } >}:|B XML #=:TB>}vJCZk DB2 for Linux, UNIX, and WindowsD ,S#|5wKgN9C updateDB2XmlSchema +;V XML #=DZ]|B*m; V XML #=DZ]#Q4FD#=+#fZf"bP#Q"a#=D SQL #={* SYSXSR# public static void updateSchema( Connection con, String schemaNameTarget, String schemaNameSource) throws SQLException { // Define and assign values to the updateDB2XmlSchema parameters String xmlSchemaNameQualifierTarget = "SYSXSR"; String xmlSchemaNameQualifierSource = "SYSXSR"; String xmlSchemaNameTarget = schemaNameTarget; String xmlSchemaNameSource = schemaNameSource; boolean dropSourceSchema = false; DB2Connection ds = (DB2Connection) con; // Invoke updateDB2XmlSchema ds.updateDB2XmlSchema( xmlSchemaNameQualifierTarget, xmlSchemaNameTarget, Z 8 B XML #=f"b 189 xmlSchemaNameQualifierSource, xmlSchemaNameSource, dropSourceSchema); } Dd"aD XSR Ts Z XML #=f"bP"as,ITDd XSR TsTtCr{CVb">}CTsr 9dk"MX*#Kb,9ITZhr7zTQ"aD XSR TsD9CX(# XZKNq XML #=f"bCZ\m XML D5T XML #="DTD rd{b?5eD@5X 5#XkWH+?v XML #="DTD rb?5e"a* XML #=f"bPD;v B XSR Ts# ]x XML #= XML #=f"b (XSR) P"aD XML #=I]xvBDf] XML #=,x;X YNi$Qf"D XML 5}D5# v|B XSR P"aD XML #=;|(d URI j6DQf" XML 5}D5#V; d# *<.0 BD XML #=Xkk-< XML #=f]E\]x#g{=v#=;f],G4 XSR_UPDATE f"}Lr UPDATE XMLSCHEMA |n+5Xms,"R;a]x NN#=#kND]x XML #=Df]T*s# XZKNq *Z XSR P]x XML #=: }L 1. wC XSR_REGISTER f"}LrKP REGISTER XMLSCHEMA |nTZ XSR P"aB XML #=# 2. ns,wC XSR_UPDATE f"}LrKP UPDATE XMLSCHEMA |nTZ XSR P|BB XML #=# B;=v24 I&D#=]x+f;-< XML #=#]xs;P|BD XML #=IC# ]x XML #=Df]T*s Z XML #=f"b (XSR) P]x XML #=D}L*s-< XML #=MCZ|B DB XML #=c;`F# g{=v XML #=;f],G4|Ba'\"RazIms{"#XkzcBf 10 vf]Tu~,E\LxjI|B}L#T>K+;zcyhv*sD#=D>}# 190 pureXML 8O tTZ] Z-< XML #=P4S`MZywr}CDtTXk,1vVZB XML # =P#xR,g{*sDtT4|(Z-< XML #=P,G4|G2;\v VZB XML #=P# >} 1 -< XML #=: B XML #=: >} 2 -< XML #=: B XML #=: *XZ] Z-< XML #=P4S`MZywr}CD*XXkvVZB XML #=P# g{*sD*X4|(Z-< XML #=P,G4|G2;\vVZB XML # =P;;\mSI!*X# >} 1 -< XML #=: Z 8 B XML #=f"b 191 B XML #=: >} 2 -< XML #=: B XML #=: >} 3 -< XML #=: 192 pureXML 8O B XML #=: fe; B XML #=Pr%`MDf5Xkk-< XML #=P(eDr%`MD5 6'f]# >} 1 -< XML #=: B XML #=: >} 2 -< XML #=: Z 8 B XML #=f"b 193 B XML #=: ;f]`M B XML #=PD*XrtTD`M;f] u~GQek XML D5} -< XML #=: B XML #=: lOZ]d*4lOZ] g{4S`MDZ]#MZ-< XML #=Pyw*lO,G4ZB XML # =P;\yw*lO# >} -< XML #=: B XML #=: 194 pureXML 8O I\xd*;I\x g{-< XML #=D*XywPDI\xtTQtC,G4|ZB XML # =P2Xk*QtC# >} -< XML #=: B XML #=: Q}%*X -< XML #=PywD+V*XXk,1vVZB XML #=P,"R;\ w*is#=# >} 1 -< XML #=: B XML #=: Z 8 B XML #=f"b 195 >} 2 -< XML #=: B XML #=: Q}%`M g{-< XML #=|,IzTm;`MD+V`M,G4+V`MXk2| ,ZB XML #=P# >} -< XML #=: B XML #=: 196 pureXML 8O r%d*4S Z-< XML #=P|,r%Z]D4S`M;\XB(e*ZQ|B XML # =P|,4SZ]# >} -< XML #=: B XML #=: r%Z] -< XML #=MB XML #=P(eDr%`MXk9C`,Dy>`M# >} -< XML #=: B XML #=: Z 8 B XML #=f"b 197 =8:]x XML #= TB=85w]xZ XML #=f"b (XSR) P"aD XML #=D}L# Jane G;RLjD-m,0pG,$}]b,dPDyPLjz7P>ZtI XML D 5P#b) XML z7Pm{OTB#=: XML #=;* Z*ekD XML #=NP,“minOccurs”tThC*“0”#b;cG#X*,qr “description”aI*Z]#MPDXh*X,xkT-<#=xPKi$"ek=}] bmPDyPVP XML D5;Y&ZP'4,#*]x XML #=,-<#=MB# =Xkf]#PXj8E",kND]x XML #=Df]T*s# XkHZ XSR P"aBD XML #=,E\xP|B: 198 pureXML 8O REGISTER XMLSCHEMA ’http://newproduct’ FROM ’file://c:/schemas/newprod.xsd’ AS STORE.NEWPROD COMPLETE XMLSCHEMA STORE.NEWPROD Jane VZ9C XSR_UPDATE f"}L4P|B: CALL SYSPROC.XSR_UPDATE( ’STORE’, ’PROD’, ’STORE’, ’NEWPROD’, 1) Q]x-< XML #=#Z XML 5}D5(H0kT XML #= STORE.PROD i $Kb)D5)D XSR P\mDyPb?@5X5y] XML #= STORE.NEWPROD DZ]xPK|B#r* dropnewschema N}G(}+]Gc5hCD,yTaZ|B -<#=s>}B#= STORE.NEWPROD# QkT-< XML D5xPKi$DyPVP XML D54r*|B}LxYNi$# Z|BZd,+*7O-< XML #=MB XML #=Gqf]x4Pli,T7#H 0kT-< XML #=xxPi$DyPD5TB#=,yP'#ZTO>}P,*s ZBD“description”*XP+“minOccurs”tThC*“0”,T9=v XML #=`f]# +kTBD STORE.PROD |Bf>i$Z#=]x.sekDyP XML D5,b) D5VZa|,?vLjz7D“description”*X# i! XML #=E"D>} P>Qr XSR "aD XML #= BP>}5wKITgN(} SQL od4i/Qr XML #=f"bj+"aD XML #=#XkjI"a.s,E\j+"a XML #=# >} 1:P>yPQ"aD XML #= K>}+5XQr XSR "aDyP XML #=D SQL #=M SQL j6# SELECT OBJECTNAME, OBJECTSCHEMA FROM SYSCAT.XSROBJECTS WHERE OBJECTTYPE=’S’ AND STATUS=’C’ >} 2:5X?j{FUdM#=;C K>}+5XyPQ"aD XML #=D?j{FUdM#=;C(targetNamespace M schemaLocation)D3;J4j6(URI)# SELECT TARGETNAMESPACE, SCHEMALOCATION FROM SYSCAT.XSROBJECTS WHERE OBJECTTYPE=’S’ AND STATUS=’C’ >} 3:5XTsE"D5 K>}+5XyPQ"aD#=DTsE"D5(schemaInfo)#K XML D5GZ# ="aZdzID,CZhviIQr XSR "aD XML #=D?v XML #=D 5# Z 8 B XML #=f"b 199 SELECT OBJECTINFO FROM SYSCAT.XSROBJECTS WHERE OBJECTTYPE=’S’ AND STATUS=’C’ lwQr XSR "aD XML #=DyPiI?V TB>}5wKITgNS XML #=f"bPlwiIQ"a XML #=DyPi~ XML #=D5# >} 1:+5XQ"aD XML #=D XML #=D5T0?j{FUdM#=;C (targetNamespace M schemaLocation): SELECT COMPONENT, TARGETNAMESPACE, SCHEMALOCATION FROM SYSCAT.XSROBJECTCOMPONENTS WHERE OBJECTSCHEMA = ? AND OBJECTNAME = ? i~ XML #=D5w* BLOB 55X# >} 2:5X_PTs{ CUSTOMER DQ"a XML #=D XML #=D5#T SAMPLE }]bKP1,od5X XML #=D5,CD5CZi$ CUSTOMER m INFO PPD XML D5: SELECT XMLPARSE(document COMPONENT) FROM SYSCAT.XSROBJECTCOMPONENTS WHERE OBJECTNAME = ’CUSTOMER’ XML #=D5w* XML 55X# lw XML D5D XML #= TB>}5wKITgNS XML #=f"bPlwk XML D5`X*D XML # =# >} 1:lw XML D5D XML #=DTsj6: SELECT DOC, XMLXSROBJECTID(DOC) FROM T >} 2:lw XML D5D XML #=DTsj6M SQL j6(I=?ViI): SELECT XMLXSROBJECTID(DOC), CAT.OBJECTSCHEMA, CAT.OBJECTNAME FROM T, SYSCAT.XSROBJECTS AS CAT WHERE XMLXSROBJECTID(DOC) = CAT.OBJECTID 200 pureXML 8O Z 9 B XML }]F/ LOAD"IMPORT M EXPORT 5CLra)KT XML }]F/D'V# ADMIN_MOVE_TABLE f"}L'VZ;9|, XML PDm&ZQz4,DivB F/b)m# yj6D#=,r_(}w}]D~PD XML }]5w{yj6D#=#9IT 9C XMLPARSE !n8(XZ?v"Ud"F/T\MBq*zX*,k9C*zmF/x;GQz mF/# IwCC}L;Nr`N,TC}L4PD?vYw4P;NwC#9C`vwCJ mzPd{!q,}g,!{F/rXFN19?jmQzTxP|B# © Copyright IBM Corp. 2006, 2013 201 PXF/ XML }]DX*"bBn h*"b#Z**{F#,y,XMLFILE !n2a)K;V=(48( EXPORT 5CLr zID XML D~Dy>{F#1! LOB D~y>{FG{FG{F"SE Gnz*};}D`E)9{T0 .lob r .xml )9{iI# } ZTB>}P,yP LOB 5+4kD~ /mypath/t1export.del.001.lob,xyP XDM 5}+4kD~ /mypath/t1export.del.001.xml: EXPORT TO /mypath/t1export.del OF DEL MODIFIED BY LOBSINFILE SELECT * FROM USER.T1 ZTB>}P,Z;v LOB 5+4kD~ /lob1/t1export.del.001.lob,Z~v LOB 5+4kD~ /lob2/t1export.del.002.lob,Z}v LOB 5+=SA /lob1/ t1export.del.001.lob,ZDv LOB 5+=SA /lob2/t1export.del.002.lob,TK `F: EXPORT TO /mypath/t1export.del OF DEL LOBS TO /lob1,/lob2 MODIFIED BY LOBSINFILE SELECT * FROM USER.T1 ZTB>}P,Z;v XDM 5}+4kD~ /xml1/xmlbase.001.xml,Z~v XDM 5}+4kD~ /xml2/xmlbase.002.xml,Z}v XDM 5}+4k /xml1/ xmlbase.003.xml,ZDv XDM 5}+4k /xml2/xmlbase.004.xml,TK`F: Z 9 B XML }]F/ 203 EXPORT TO /mypath/t1export.del OF DEL XML TO /xml1,/xml2 XMLFILE xmlbase MODIFIED BY XMLINSEPFILES SELECT * FROM USER.T1 } TZ|,%v XML PD“mytable”mMTB IMPORT |n: IMPORT FROM myfile.del of del LOBS FROM /lobpath XML FROM /xmlpath MODIFIED BY LOBSINFILE XMLCHAR replace into mytable g{“myfile.del”|,TB}]: mylobfile.001.lob.123.456/ IMPORT 5CLr+"TSD~ /lobpath/mylobfile.001.lob PD~+F?* 123 & *< XML }]# XDS Gm>* XML jG(d{FG“XDS”)DV{.,|_PCZhvXZPP5J XML }]DE"DtT;bVE"f0|,5J XML }]DD~{,T0CD~Z XML }]D+F?M$H#TBPmhvK XDS DtT# FIL |, XML }]DD~D{F#;\8(|{\@#;'VS|{\@"&"’ M ″)Xk} TB>}T> XDS vVZ(g ASCII }]D~P1Dy=#XML }]f"Z xmldocs.xml.001 D~PVZ+F?S 100 *m|,D+}EXkS6# 204 pureXML 8O "" TB>}T>j< SQL j6 ANTHONY.purchaseOrderTest#Z XDS P,xVs!4 Dj6?VXkEZ " V{5ed: "" XML }]#XDS Gm>* XML jG(d{FG“XDS”)DV{.,|_PCZhvXZPP5J XML }]D E"DtT;bVE"f0|,5J XML }]DD~{,T0CD~Z XML }]D +F?M$H# IT9C XML TO M XMLFILE !n8({F# g{8(K XML TO r XMLFILE !n,G4Q{F|(Q} ZBP>}P,Y( USER.T1 m|,DP=P: C1 INTEGER C2 XML C3 VARCHAR(10) C4 XML m 27. USER.T1 C1 C2 C3 C4 2 You Menote1 Hello World! ’char1’ Him Hernote2< body>Hello World! 4 NULL ’char2’ ?xml version=″1.0″ encoding=″UTF-8″ ?>to>Us Themnote3 Hello World! Z 9 B XML }]F/ 205 >} 1 TB|n+(g ASCII(DEL)q=D USER.T1 DZ] { F * “t1export.del.xml”#XMLSAVESCHEMA !n8>+Z","char1", "" 4,,"char2","" You Menote1Hello World! Him Hernote2Hello World! UsThemheading>note3 Hello World! >} 2 TB|n+ DEL q=D USER.T1 DZ]{F“xmldocs”|{ XML D~,"++Z","char1", "" 4,,"char2","" You Menote1Hello World! HimHernote2 Hello World! UsThem note3Hello World! >} 3 }K+} 2 `F# EXPORT TO /mypath/t1export.del OF DEL XML TO /home/user/xmlpath XMLFILE xmldocs MODIFIED BY XMLINSEPFILES XMLSAVESCHEMA SELECT * FROM USER.T1 ","char1","XDS FIL=’xmldocs.002.xml’ />" 4,,"char2","" You Menote1Hello World! note time="13:00:00">to>Him/to> from>Her/from>heading>note2/heading>body>Hello World!/body> /note> Us Themnote3Hello World! >} 4 TB|n+ XQuery Da{4k XML D~# EXPORT TO /mypath/t1export.del OF DEL XML TO /home/user/xmlpath XMLFILE xmldocs MODIFIED BY XMLNODECLARATION select xmlquery( ’$m/note/from/text()’ passing by ref c4 as "m" returning sequence) from USER.T1 " "" }P}P,+kT}P,+kT 'V9CQywNj40k XML }]#TB>}ywNj"9CCNjM LOAD |n +m CUSTOMERS PD}]mS=m LEVEL1_CUSTOMERS P: DECLARE cursor_income_level1 CURSOR FOR SELECT * FROM customers WHERE XMLEXISTS(’$DOC/customer[income_level=1]’); LOAD FROM cursor_income_level1 OF CURSOR INSERT INTO level1_customers; + XML }]0k= XML PP1'V LOAD |n9C ANYORDER D~`M^N{# Z0kZd,;aU/`M* XML DPDV<3FE"# ZVx}]b73P0k XML }] TZV}P,+kTI(g ASCII dkD~ data2.del PD XDS j6D#=i$kV XML D5: LOAD FROM data2.del OF DEL XML FROM /home/user/xmlpath XMLVALIDATE USING XDS INSERT INTO USER.T2 ZbVivB,XDS |, SCH tT0CZi$D XML #=Dj< SQL j6 “S1.SCHEMA_A”: 208 pureXML 8O 8(bv!n IT9C XMLPARSE !n48(G#t9G%t0kD XML D5PDUq#ZTB >}P,+kTxP SQL j6“S2.SCHEMA_A”D#=i$yP0kD XML D5, "RZ#tUqDivBbvb)D5: LOAD FROM data2.del OF DEL XML FROM /home/user/xmlpath XMLPARSE PRESERVE WHITESPACE XMLVALIDATE USING SCHEMA S2.SCHEMA_A INSERT INTO USER.T1 bv0k XML }]1"zD("w}ms (}9C db2diag U>D~M IMPORT 5CLr4j6"|} XML }]PDJb 5,ITbvIZ("w}msx'\D0kYw# XZKNq g{0kYw5Xms{" SQL20305N(SQL zk* -20305),G4m>4\T;v r`v XML Zc5("w}#ms{"advCmsD-rk#Z|nP&mwPd k ? SQL20305N,TiR`&-rkD5wMC'l&# TZ4PekYwZdzzDk("w}PXDJb,zID XQuery odadv= db2diag U>D~,TozZD5PRv'\D XML Zc5#kND“#{ XML ( "w}Jb”,TKbPXgN9C XQuery od4iR'\D XML Zc5Dj8E "# +G,TZ4P0kYwZdzzDk("w}PXDJb,zID XQuery od;a dv= db2diag U>D~#*zIb) XQuery od,XkT40kD'\PKP IMPORT 5CLr#r*;\xDP;ZmP,yT;\T'\D5KP XQuery o d#*bvKJb,Xk4(xP`,(eDBm,+;|,NNw}#;sI+' \DP<]=BmP,;sITBmKP XQuery od,TZD5PRv'\D XML Zc5# 4PTB=h4bv("w}ms: }L 1. 9CdvE"PDGD~"q!zID XQuery od#*ZdkD5PiR'\ DZc5,kZ db2diag U>D~PQwV{.“SQL20305N”"k-rk`E% d#@]-rk,zaR=;i8>E"MzID XQuery od,I9C|G4 RvD5P} ZTB>}P,QT date }]`M4(w} BirthdateIndex#Q8( REJECT INVALID VALUES !n,yT /Person/Confidential/Birthdate D XML #=5Xk+?T date } ]`MP'#g{NN XML #=5;\*;*K}]`M,G4+5Xms# 9CTB XML D5a0k 5 P,+Z 1 PMZ 4 Pa;\x,-rG;\T Birthdate 5("w}#ZD~ person1.xml P,5 March 16, 2002 DUZq=;} 7#ZD~ person4.xml P,5 20000-12-09 Dj]?VfZ``Dc,yT|GP 'D XML UZ5,+Z DB2 JmDj]6'(0001 A 9999).b#Q`-;)y >dvT9>}|S+7# *0kD 5 v XML D~gBy>: person1.xml (Birthdate 5^') Cool Joe 5 March 16, 2002 111-22-3333
5224 Rose St. San Jose, CA 95123
person2.xml(Birthdate 5P') Cool Joe 5 2002-03-16 111-22-3333
5224 Rose St. San Jose, CA 95123
person3.xml(Birthdate 5P') McCarthy Laura 6 2001-03-12 210 pureXML 8O 444-55-6666
5960 Daffodil Lane, San Jose, CA 95120
person4.xml(Birthdate 5^') Wong Teresa 7 20000-12-09 555-66-7777
5960 Tulip Court, San Jose, CA 95120
person5.xml(Birthdate 5P') Smith Chris 10 1997-04-23 666-77-8888
5960 Dahlia Street, San Jose, CA 95120
dkD~ person.del |,: 1, 2, 3, 4, 5, DDL M LOAD odgBy>: CREATE TABLE T1 (docID INT, XMLDoc XML); CREATE INDEX BirthdateIndex ON T1(xmlDoc) GENERATE KEY USING XMLPATTERN ’/Person/Confidential/Birthdate’ AS SQL DATE REJECT INVALID VALUES; LOAD FROM person.del OF DEL INSERT INTO T1 *bv"T0kOfP>D XML D~/O1"zD("w}ms,&4PTB=h: 1. 9CdvE"PDG}DP} =0 d5DP} =5 2. 9C;\xDP4(BD~ reject.del# 1, 4, 3. 4(|,-D~"q!zID XQuery od# /}:DB2 UDB,XML f"wMw}\mw,xmlsDumpXQuery,=b:608 DATA #1:V{.,36 VZ SQL zk:SQL20305N;-rk:5 DATA #2:V{.,265 VZ *iRD5P {$i} {$i/*:Person/*:Confidential/*:Birthdate/..} ; c. ^D XQuery odT9CBm T2# xquery for $i in db2-fn:xmlcolumn( "LEECM.T2.XMLDOC")[/*:Person/*:Confidential/*:Birthdate="March 16, 2002"] return 212 pureXML 8O {$i} {$i/*:Person/*:Confidential/*:Birthdate/..} ; d. Tm T2 KP XQuery odTiRD5PDJb5# Cool Joe 5 March 16, 2002 111-22-3333
5224 Rose St. San Jose, CA 95123
5 March 16, 2002 111-22-3333
e. Z|,CD5DD~ person1.xml P^}Jb5#March 16, 2002 DUZq= ;}7,yT|+|D* 2002-03-16# Cool Joe 5 2002-03-16 111-22-3333
5224 Rose St. San Jose, CA 95123
f. 5X=h A TYN+;\xDPD~"q!zID XQuery od# /}:DB2 UDB,XML f"wMw}\mw,xmlsDumpXQuery,=b:608 DATA #1:V{.,36 VZ SQL zk:SQL20305N;-rk:4 DATA #2:V{.,265 VZ *iRD5P {$i} {$i/*:Person/*:Confidential/*:Birthdate/..} ; c. ^D XQuery odT9Cm T2# xquery for $i in db2-fn:xmlcolumn("LEECM.T2.XMLDOC") [/*:Person/*:Confidential/*:Birthdate="20000-12-09"] return {$i} {$i/*:Person/*:Confidential/*:Birthdate/..} ; d. KP XQuery odTiRD5PDJb5# Wong Teresa 7 20000-12-09 555-66-7777
5960 Tulip Court, San Jose, CA 95120
7 20000-12-09 555-66-7777
e. Z|,CD5DD~ person4.xml P^}Jb5#5 20000-12-09 Dj]?V fZ``Dc,yT|Z DB2 JmDj]6'(0001 A 9999).b#C5+ |D* 2000-12-09# Wong Teresa 7 2000-12-09 555-66-7777
5960 Tulip Court, San Jose, CA 95120
f. 5X=h A TYN+;\xDP 4zk3PDV{1,Ma*'}]# &CLrITS XML PPlw{v XML D5r;vrP# Cf{v XML D51,+CD5lw=&CLrd?P# lw XML rP1,zP8V!q: v 1S4P XQuery mo=# *Z&CLrP4P XQuery mo=,H+V{. ’XQUERY’ =S= XQuery mo =.0,;s/,4PzIDV{.# 1S4P XQuery mo=1,DB2 }]b~qw5X XQuery odDa{rPw* a{m#a{mPD?PGrPPD;n# v Z SQL SELECT r%P SELECT INTO YwZ,wC XMLQUERY r XMLTABLE ZC/}"+ XQuery mo=w*Td?+]# © Copyright IBM Corp. 2006, 2013 217 K=(Ik2,r/, SQL T0NN&CLr`LoTdO9C#XMLQUERY G ;vj?/},|5X&CLrd?PD{vrP#XMLTABLE G;vm/},| 5XrPPD?;nw*a{mDP#a{mPDPGlw=DrPnPD5# N}jGMwd? ;\Z XQuery mo=PDNN;C(|(Z XQuery mo=P8(D SQL P)8( N}jGrwd?#}g,XQuery /} db2-fn:sqlquery Jmz8(;v_P XQuery mo=D SQL +i/,4i!Tz7Dj8hv: xquery db2-fn:sqlquery("select description from product where pid=’100-103-01’") /product/description/details/text() ;\Z XQuery mo=P8(N}jGrwd?,49Z+i/P2GgK#TBmo= GmsD,2;\'V(|+5X SQLSTATE 42610,sqlcode -418): xquery db2-fn:sqlquery("select description from product where pid=?") /product/description/details/text() *+&CLr5+]x XQuery mo=,I9C SQL/XML /} XMLQUERY M XMLTABLE#b)/}D PASSING SdJmzZT XQuery mo=s5Zd9C& CLr5# TBi/5wgN9C SQL/XML 4X4H0Dmsi/,TcqCH[Da{: SELECT XMLQUERY (’$descdoc/product/description/details/text()’ passing description as "descdoc") FROM product WHERE pid=? CLI CLI &CLrPD XML }]&m - Ev CLI &CLrI(}9C SQL_XML }]`MlwMf" XML }]#K}]`MT &Z DB2 }]bD>z XML }]`M,C}]`MC4(eCZf"a9z XML }]`M,C}]`MC4(eCZf"a947(}]D`k: v g{ C `M* SQL_C_WCHAR,G4 CLI +Y(}]GIC UCS-2 4`kD# v g{ C `M* SQL_C_CHAR r SQL_C_DBCHAR,G4 CLI +Y(}]GIC &CLrzk3`k=84`kD# g{h*}]b~qwZ+}]f"= XML PP.0~=bvC}],G4&+ SQLBindParameter() PDN}jG}]`M8(* SQL_XML# (ixP~=bv,r*9C XMLPARSE 4T=bvV{`M+zz`kJb# TB>}5wgN9C(iD SQL_C_BINARY `M4|B XML PPD XML }]# Z 10 B &CLr`LM}L'V 219 char xmlBuffer[10240]; integer length; // Assume a table named dept has been created with the following statement: // CREATE TABLE dept (id CHAR(8), deptdoc XML) // xmlBuffer contains an internally encoded XML document that is to replace // the existing XML document length = strlen (xmlBuffer); SQLPrepare (hStmt, "UPDATE dept SET deptdoc = ? WHERE id = ’001’", SQL_NTS); WHERE id = ’001’", SQL_NTS); SQLBindParameter (hStmt, 1, SQL_PARAM_INPUT, SQL_C_BINARY, SQL_XML, 0, 0, xmlBuffer, 10240, &length); SQLExecute (hStmt); Z CLI &CLrPlw XML }] TZ XML }],1z9C SQLBindCol() 4+i/a{/PDPs(A&CLrd? 1 , I T + &CL r d ? D } ] ` M 8 ( * SQL_C_BINARY"SQL_C_CHAR"SQL_C_DBCHAR r SQL_C_WCHAR# 1SmD XML PP!q}]1,dv}]ICQrP/DV{.q=# TZ XML }],1z9C SQLBindCol() 4+i/a{/PDPs(A&CLrd? 1 , I T + &CL r d ? D } ] ` M 8 ( * SQL_C_BINARY"SQL_C_CHAR"SQL_C_DBCHAR r SQL_C_WCHAR#1S XML PPlwa{/1,(iz+&CLrd?s(A SQL_C_BINARY `M#g{s(A V{`M,G4I\ar4Pzk3*;xlI}]*'#1?jzk3P^(m> 4zk3PDV{1,Ma*'}]#x+d?s(A SQL_C_BINARY C `MMIT \bb)Jb# XML }]+w*Z?`kD}]5Xx&CLr#CLI 4gBy>47(}]D`k: v g{ C `M* SQL_C_BINARY,G4 CLI +IC UTF-8 `k=845X}]# v g{ C `M* SQL_C_CHAR r SQL_C_DBCHAR,G4 CLI +IC&CLrz k3`k=845X}]# v g{ C `M* SQL_C_WCHAR,G4 CLI +IC UCS-2 `k=845X}]# Z+}]5Xx&CLr.0,}]b~qw+T}]4P~=rP/#IT(}w C XMLSERIALIZE /}4+ XML }]T=rP/*X(}]`M#+G,(iz9 C~=rP/,r*9C XMLSERIALIZE 4TV{`MxPT=rP/1I\azz `kJb# TB>}5wgN+ XML PPD XML }]lw=~xF&CLrd?P# char xmlBuffer[10240]; // xmlBuffer is used to hold the retrieved XML document integer length; // Assume a table named dept has been created with the following statement: // CREATE TABLE dept (id CHAR(8), deptdoc XML) length = sizeof (xmlBuffer); SQLExecute (hStmt, "SELECT deptdoc FROM dept WHERE id=’001’", SQL_NTS); SQLBindCol (hStmt, 1, SQL_C_BINARY, xmlBuffer, &length, NULL); SQLFetch (hStmt); SQLCloseCursor (hStmt); // xmlBuffer now contains a valid XML document encoded in UTF-8 220 pureXML 8O |D CLI &CLrPD1! XML `M&m CLI 'V CLI/ODBC dCX|V,TZZhvr8( XML PMN}jGD SQL_C_DEFAULT 1;Z{5X1!`MD&CLr,b)dCX|V+a)f]T# CLI 'V CLI/ODBC dCX|V,TZZhvr8( XML PMN}jGD SQL_C_DEFAULT 1;Z{5X1!`MD&CLr,b)dCX|V+a)f]T# 1hv XML PrN}1,OID CLI M ODBC &CLrI\;6pr_;Z{1 ! SQL_XML `M#TZ XML PMN}jG,3) CLI r ODBC &CLrI\9 Z{ SQL_C_BINARY .bD1!`M#*KTb)`MD&CLra)f]T,CLI 'V MapXMLDescribe M MapXMLCDefault X|V# MapXMLDescribe 8(Zhv XML PrN}jG1+5XDV SQL }]`M# MapXMLCDefault 8(Z* CLI /}PD XML PMN}jG8( SQL_C_DEFAULT 1+9C C `M# 6k= SQL Z6k= SQL &CLrPyw XML wd? *5VZ}]b~qwk6k= SQL &CLr.d;; XML }],h*Z&CLr 4zkPywwd?# XZKNq DB2 V9.1 }kK;V XML }]`M,C}]`M+ XML }]f"Z;iICwN a9Da9/ZcP#_PK XML }]`MDP;hv* SQL_TYP_XML P SQLTYPE,"R&CLrITTb)PrN}DdkMdvs(wVX(ZoTD} ]`M#IT1S9C SQL"SQL/XML )9r XQuery 4CJ XML P#XML }] `M;;GJCZP#/}IT+ XML 5CwTd?,9ITzI XML 5#,y X,f"}LITIC XML 5w*dkN}MdvN}#ns,^[ XQuery mo= GqCJ XML P,|GJO45,XML }]GV{,"R_PC48(y9CDV{/D`k#ITZb ?7( XML }]D`k,|GS|, XML D5DrP/V{.m>Dy>&CLr `MIzx4D#2ITZZ?7(|,+Gh*T}]xPbM#TZ Unicode `k D5,(i9CVZ3rjG(BOM),|I;Z}]w*7D Unicode V{zki I#BOM Cw;vXw{,|(eVZ3rM Unicode `kq=# } K XML w d ? T b , 9 I T 9 C V P V { M ~ x F ` M ( | ( CHAR"VARCHAR"CLOB M BLOB)4CfMek}]#+G,|G;aq XML wd?Gy@5Z XML bv#xG}k"&CK_P1!Uq%t&\DT= XMLPARSE /}# PX*"6k= SQL &CLrD XML M XQuery ^F *Z6k= SQL &CLrPyw XML wd?: Z&CLrDyw?V,+ XML wd?yw* LOB }]`M: v Z 10 B &CLr`LM}L'V 221 SQL TYPE IS XML AS CLOB(n) dP G;v CLOB wd?,||,9C&CLrDlOzk3`k D XML }]# v SQL TYPE IS XML AS DBCLOB(n) dP G;v DBCLOB wd?,||,9C&CLr dP G;v BLOB wd?,||,ZZ?`kD XML }]1# v SQL TYPE IS XML AS CLOB_FILE dP G;v CLOB D~,||,9C&CLrlOzk3`kD XML }]# v SQL TYPE IS XML AS DBCLOB_FILE dP G;v DBCLOB D~,||,9C&CLr dP G;v BLOB D~,||,ZZ?`kD XML }]1# ": 1. kNDCZy] XML 1.0 f67(`kDc((http://www.w3.org/TR/REC-xml/ #sec-guessing-no-ext-info)# >}:}C6k= SQL &CLrPD XML wd? TBy>&CLr5wKgN}C9C C M COBOL oTD XML wd?# TBy>&CLr5wKgN}C9C C M COBOL oTD XML wd?# >}:6k= SQL C &CLr TBzk>}xPKq=`ETc|Se~wK: EXEC SQL BEGIN DECLARE; SQL TYPE IS XML AS CLOB( 10K ) xmlBuf; SQL TYPE IS XML AS BLOB( 10K ) xmlblob; SQL TYPE IS CLOB( 10K ) clobBuf; EXEC SQL END DECLARE SECTION; // as XML AS CLOB // The XML value written to xmlBuf will be prefixed by an XML declaration // similar to: // Note: The encoding name will depend upon the application codepage EXEC SQL SELECT xmlCol INTO :xmlBuf FROM myTable WHERE id = ’001’; EXEC SQL UPDATE myTable 222 pureXML 8O SET xmlCol = :xmlBuf WHERE id = ’001’; // as XML AS BLOB // The XML value written to xmlblob will be prefixed by an XML declaration // similar to: EXEC SQL SELECT xmlCol INTO :xmlblob FROM myTable WHERE id = ’001’; EXEC SQL UPDATE myTable SET xmlCol = :xmlblob WHERE id = ’001’; // as CLOB // The output will be encoded in the application character codepage, // but will not contain an XML declaration EXEC SQL SELECT XMLSERIALIZE (xmlCol AS CLOB(10K)) INTO :clobBuf FROM myTable WHERE id = ’001’; EXEC SQL UPDATE myTable SET xmlCol = XMLPARSE (:clobBuf PRESERVE WHITESPACE) WHERE id = ’001’; >}:6k= SQL COBOL &CLr TBzk>}xPKq=`ETc|Se~wK: EXEC SQL BEGIN DECLARE SECTION END-EXEC. 01 xmlBuf USAGE IS SQL TYPE IS XML as CLOB(5K). 01 clobBuf USAGE IS SQL TYPE IS CLOB(5K). 01 xmlblob USAGE IS SQL TYPE IS BLOB(5K). EXEC SQL END DECLARE SECTION END-EXEC. *asXML EXEC SQL SELECT xmlCol INTO :xmlBuf FROM myTable WHERE id = ’001’ END-EXEC. EXEC SQL UPDATE myTable SET xmlCol = :xmlBuf WHERE id = ’001’ END-EXEC. * as BLOB EXEC SQL SELECT xmlCol INTO :xmlblob FROM myTable WHERE id = ’001’ END-EXEC. EXEC SQL UPDATE myTable SET xmlCol = :xmlblob WHERE id = ’001’ END-EXEC. * as CLOB EXEC SQL SELECT XMLSERIALIZE(xmlCol AS CLOB(10K)) INTO :clobBuf FROM myTable WHERE id= ’001’ END-EXEC. EXEC SQL UPDATE myTable SET xmlCol = XMLPARSE(:clobBuf) PRESERVE WHITESPACE WHERE id = ’001’ END-EXEC. 4P6k= SQL &CLrPD XQuery mo= IT+ XML }]f"ZmP,9IT9C6k= SQL &CLr"9C XQuery mo =4CJ XML P# *<.0 IT+ XML }]f"ZmP,9IT9C6k= SQL &CLr"9C XQuery mo =4CJ XML P#*CJ XML }],I9C XML wd?,x;G+}]?F* ;*V{r~xF}]`M#g{z;{C XML wd?,G4CZCJ XML }]D nQfz=(G9C FOR BIT DATA r BLOB }]`M,T\bxPzk3*;# Z 10 B &CLr`LM}L'V 223 v Z6k= SQL &CLrPyw XML wd?# XZKNq v Xk9C XML `M4lw2, SQL SELECT INTO odPD XML 5# v g{Th* XML 5Ddk9C CHAR"VARCHAR"CLOB r BLOB wd?,G 45+@5Z_P1!Uq(STRIP)&mD XMLPARSE /}Yw#qr,h*9 C XML wd?# *1S"v6k= SQL &CLrPD XQuery mo=,&Zmo=0fmS“XQUERY” X|V#TZ2, SQL,9C XMLQUERY /}#1wC XMLQUERY /}1,; aZ XQuery mo=0fmS“XQUERY”# b)>}+5Xy>}]bD CUSTOMER mP XML D5PD}]# >} 1:(}Z0fmS“XQUERY”X|V4Z C M C++ /, SQL P1S4P XQuery mo= Z C M C++ &CLrP,ITICTB==4"v XQuery mo=: EXEC SQL INCLUDE SQLCA; EXEC SQL BEGIN DECLARE SECTION; char stmt[16384]; SQL TYPE IS XML AS BLOB( 10K ) xmlblob; EXEC SQL END DECLARE SECTION; sprintf( stmt, "XQUERY (for $a in db2-fn:xmlcolumn("CUSTOMER.INFO") /*:customerinfo[*:addr/*:city = "Toronto"]/@Cid return data($a))"); EXEC SQL PREPARE s1 FROM :stmt; EXEC SQL DECLARE c1 CURSOR FOR s1; EXEC SQL OPEN c1; while( sqlca.sqlcode == SQL_RC_OK ) { EXEC SQL FETCH c1 INTO :xmlblob; /* Display results */ } EXEC SQL CLOSE c1; EXEC SQL COMMIT; >} 2:9C XMLQUERY /}M XMLEXISTS =JZ2, SQL P4P XQuery mo= IT4gBy>2,`k|, XMLQUERY /}D SQL od: EXEC SQL INCLUDE SQLCA; EXEC SQL BEGIN DECLARE SECTION; SQL TYPE IS XML AS BLOB( 10K ) xmlblob; EXEC SQL END DECLARE SECTION; EXEC SQL DECLARE C1 CURSOR FOR SELECT XMLQUERY(data($INFO/*:customerinfo/@Cid)’) FROM customer WHERE XMLEXISTS(’$INFO/*:customerinfo[*:addr/*:city = "Toronto"]’); EXEC SQL OPEN c1; while( sqlca.sqlcode == SQL_RC_OK ) { EXEC SQL FETCH c1 INTO :xmlblob; /* Display results */ } EXEC SQL CLOSE c1; EXEC SQL COMMIT; >} 3:Z COBOL 6k= SQL &CLrP4P XQuery mo= Z COBOL &CLrP,ITICTB==4"v XQuery mo=: EXEC SQL BEGIN DECLARE SECTION END-EXEC. 01 stmt pic x(80). 01 xmlBuff USAGE IS SQL TYPE IS XML AS BLOB (10K). EXEC SQL END DECLARE SECTION END-EXEC. 224 pureXML 8O MOVE "XQUERY (for $a in db2-fn:xmlcolumn("CUSTOMER.INFO")/*:customerinfo [*:addr/*:city = "Toronto"]/@Cid return data($a)))" TO stmt. EXEC SQL PREPARE s1 FROM :stmt END-EXEC. EXEC SQL DECLARE c1 CURSOR FOR s1 END-EXEC. EXEC SQL OPEN c1 USING :host-var END-EXEC. *Call the FETCH and UPDATE loop. Perform Fetch-Loop through End-Fetch-Loop until SQLCODE does not equal 0. EXEC SQL CLOSE c1 END-EXEC. EXEC SQL COMMIT END-EXEC. Fetch-Loop Section. EXEC SQL FETCH c1 INTO :xmlBuff END-EXEC. if SQLCODE not equal 0 go to End-Fetch-Loop. * Display results End-Fetch-Loop. exit. XZ9C XML M XQuery *"6k= SQL &CLrD(i TZZ6k= SQL &CLrP9C XML M XQuery,a)KBP(i,"R9fZ BP^F# TZZ6k= SQL &CLrP9C XML M XQuery,a)KBP(i,"R9fZ BP^F# v &CLrXkCJICQrP/V{.q=DyP XML }]# – XkICQrP/V{.q=4m>yP}](|(}VMUZ1d}])# v b?/D XML }]n`;\* 2GB# v |, XML }]DyPNj`M# v BP(iM^FJCZ2, SQL: – ;\9CV{M~xFwd?4S SELECT INTO YwPlw XML 5# – Zdkh* XML }]`MDivB,9C CHAR"VARCHAR"CLOB M BLOB wd?+@5Z_P1!Uq&mXw (’STRIP WHITESPACE’) D XMLPARSE Yw# xNNd{G XML wd?`M<+;\x# – ;'V2, XQuery mo=;"T$`k XQuery mo=1+'\,"Razz ms#;\(} XMLQUERY /}4"v XQuery mo=# v (}Z XQuery mo=0fmS;v“XQUERY”V{.,MIT/,"vCmo=# j6 SQLDA PD XML 5 *8>y>`M_P XML }],Xk4gBy>|B SQLVAR D sqlname VN# *8>y>`M_P XML }],Xk4gBy>|B SQLVAR D sqlname VN: v sqlname.length Xk* 8 v sqlname.data D0=vVZXkG X’0000’ v sqlname.data DZ}MZDvVZXkG X’0000’ v sqlname.data DZevVZXkG X’01’(v1zc0=vu~1EF* XML S `M8>{) v d`VZXkG X’000000’ Z 10 B &CLr`LM}L'V 225 g{Z SQLTYPE ;G LOB D SQLVAR PhCK XML S`M8>{,G4ZK P1+5X SQL0804 ms(rc=115)# ":;\S DESCRIBE odP5X SQL_TYP_XML#K`M;\CZNNd{ks# &CLrXk^D SQLDA T|,P'V{r~xF`M,"J1XhC sqlname V NT8>}]G XML# Java Java &CLrPD~xF XML q= IBM Data Server Driver for JDBC and SQLJITIC~xF XML }](I)9/, ~xF XML DB2 M'z/~qw~xF XML q=D}])Dq=+ XML }]"M A}]~qwr_SPlw XML }]#}]~qwXk'V~xF XML }]# XML }]Dq=TZ&CLrG8wD#f"Mlw~xF XML }]h* IBM Data Server Driver for JDBC and SQLJ V4.9 r|_f>#g{*Z SQLJ &CLrP9C ~xF XML }],G49h* V4.9 r|_f>D sqlj4.zip Lr|# IT9CtT xmlFormat 4XF XML }]lwD}]q=GD> XML q=9G~ xF XML q=#IT+ xmlFormat hC* XML_FORMAT_BINARY (1) TtC~ xF XML q=#1!hC*D> XML q=# TZ|B XML mPPD}],xmlFormat ;P'{#g{dk}]G~xF XML } ],"R}]~qw;'V~xF XML }],G4a+dk}]*;*D> XML } ]#qr,+;axP*;# TB>}T>K9C DataSource SZ+}]+dhC*~xF XML q=Dod: import com.ibm.db2.jcc.DB2SimpleDataSource; ... DB2SimpleDataSource ds = new DB2SimpleDataSource(); ds.setXmlFormat(DB2BaseDataSource.XML_FORMAT_BINARY); *+}]+dhC*D> XML q=,IT9CgBod: ds.setXmlFormat(DB2BaseDataSource.XML_FORMAT_TEXTUAL); ;PZ Connection SZP* xmlFormat tT(e setXXX =(#rK,*9C Con- nection S Z 4 h C xmlFormat 5 , h * 8 ( xmlFormat w * Z 4 P DriverManager.getConnection =(1DtT,gTB>}y>: properties.put("xmlFormat", "1"); DriverManager.getConnection(url, properties); IBM Data Server Driver for JDBC and SQLJv(} XML TsSZ4T&CLra) ~xF XML }]#C'4;=~xF XML q=D}]# 9C~xF XML }]1,+]= IBM Data Server Driver for JDBC and SQLJD~ xF XML }]^(}Cb?5e"Z?5erZ? DTD#v1H0Z}]4P"a Kb? DTD 1,b) DTD E\'V# TZdkrdv}]ICGD>m>(}g,SAX"StAX r DOM)Div,~xF XML q=D'Jn_#}g,TB=(+lwICGD>m>D XML }]: v getSource(SAXSource.class) 226 pureXML 8O v getSource(StAXSource.class) v getSource(DOMSource.class) TB=(+|Bd}]ICGD>m>D XML P: v setResult(SAXResult.class) v setResult(StAXResult.class) v setResult(DOMResult.class) SAX m>GlwIC~xF XML q=D}]1'Jn_D=(,bGr*b)}] ;a-zS~xFq==D>q=Dnb*;# Y(z+ xmlFormat hC* XML_FORMAT_BINARY (1)#ZTB JDBC >}P,IBM Data Server Driver for JDBC and SQLJlwIC~xF XML q=D}],&CLr 9C SAX bvw4bvylwD}]# ... Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("SELECT XMLCOL FROM XMLTABLE"); ContentHandler handler = new MyContentHandler(); while (rs.next()) { SQLXML sqlxml = rs.getSQLXML(1); SAXSource source = sqlxml.getSource(SAXSource.class); XMLReader reader = source.getXMLReader(); reader.setContentHandler(handler); reader.parse(source.getInputSource()); } ... TB SQLJ >}4P`,DYw# #sql iterator SqlXmlIter(java.sql.SQLXML); { ... SqlXmlIter SQLXMLiter = null; java.sql.SQLXML outSqlXml = null; ContentHandler handler = new MyContentHandler(); #sql [ctx] SQLXmlIter = {SELECT XMLCOL FROM XMLTABLE}; #sql {FETCH :SqlXmlIter INTO :outSqlXml}; while (!SQLXMLIter.endFetch()) { SAXSource source = outSqlXml.getSource(SAXSource.class); XMLReader reader = source.getXMLReader(); reader.setContentHandler(handler); reader.parse(source.getInputSource()); #sql {FETCH :SqlXmlIter INTO :outSqlXml}; } ... } JDBC JDBC &CLrPD XML }] Z JDBC &CLrP,IT+}]f"Z XML PP"S XML PPlw}]# Z}]bmP,XML ZC}]`MCZ+ XML }]T;iICwNa9Da9/Z cN=f"ZPP# JDBC &CLrIT9CBPdP;Vq=+ XML }]"MA}]~qwr_SPl w XML }]: v D> XML }] Z 10 B &CLr`LM}L'V 227 v ~xF XML }](g{}]~qw'VC}]) Z JDBC &CLrP,zIT4PBPYw: v 9C setXXX =(+{v XML D5f"Z;v XML PP# v 9C getXXX =(S;v XML PPlw{v XML D5# v (}TB=(S XML PPDD5Zlw;vrP:9C SQL XMLQUERY /}+ CrPlw=}]bPD;vQrP/rPP,;s9C getXXX =(+}]lw= &CLrd?P# v (}TB=(S XML PPDD5Zlw;vrP:9C0fmSKV{. “XQUERY”D XQuery mo=4+CrPD*Xlw=}]bPDa{mP,xa{ mPD?;PCrPPD;n#;s9C getXXX =(+}]lw=&CLr d?P# v (}TB=(S XML PPDD5Zlw;vw*C'(eDmDrP:9C SQL XMLTABLE /}4(e"lwa{m#;s9C getXXX =(4+}]Sa{ml w=&CLrd?P# IT9C JDBC 4.0 java.sql.SQLXML Ts4lwM|B XML PPD}]#g{wC ng ResultSetMetaData.getColumnTypeName .`D*}]=(,G4aT XML P` M5X{}5 java.sql.Types.SQLXML# JDBC &CLrPD XML P|B Z JDBC &CLrP,zIT9C XML D>}]|B}]r+}]ek DB2 }] ~qwOmD XML PP#g{}]~qw'V I)9/,~xF XML DB2 M'z/ ~qw~xF XML q= PD XML }],G4zIT|B}]r9C~xFq=+ }]ek= XML P# BmP>KIC4+}]Ek XML PD=(M`&Ddk}]`M# m 28. CZ|B XML PD=(M}]`M =( dk}]`M PreparedStatement.setAsciiStream InputStream PreparedStatement.setBinaryStream InputStream PreparedStatement.setBlob Blob PreparedStatement.setBytes byte[] PreparedStatement.setCharacterStream Reader PreparedStatement.setClob Clob PreparedStatement.setObject b y t e [ ] " Blob" Clob" SQLXML" DB2Xml( ; F v 9 C ) " InputStream"Reader M String PreparedStatement.setSQLXML1 SQLXML PreparedStatement.setString String ": 1. K=(h*9C JDBC 4.0 r|_f># 228 pureXML 8O XML }]D`kITS}]>mIz(F*Z?`k}]),2ITSb?4Iz(F *b?`k}])#w*~xF}]"MA}]b~qwD XML }];1wZ?`k D}]4&m#w*V{}]"MA}]4D XML }];1wb?`kD}]4& m# Java &CLrDb?`k4&mZ?`kkb?`k.dD;f] T: v g{}]4G DB2 for Linux, UNIX, and Windows,G4Zb?`kkZ?`k; f]DivB,}]b4+zzms,}Gb?`kMZ?`k}:TB>}5wKgN+ SQLXML TsPD}]ek XML PP#}]GV{. }],rK,}]b4+|G1wb?`k4&m# public void insertSQLXML() { Connection con = DriverManager.getConnection(url); SQLXML info = con.createSQLXML(); // Create an SQLXML object PreparedStatement insertStmt = null; String infoData = "..."; info.setString(infoData); // Populate the SQLXML object int cid = 1000; try { sqls = "INSERT INTO CUSTOMER (CID, INFO) VALUES (?, ?)"; insertStmt = con.prepareStatement(sqls); insertStmt.setInt(1, cid); insertStmt.setSQLXML(2, info); // Assign the SQLXML object value // to an input parameter if (insertStmt.executeUpdate() != 1) { System.out.println("insertSQLXML: No record inserted."); } } catch (IOException ioe) { ioe.printStackTrace(); } catch (SQLException sqle) { System.out.println("insertSQLXML: SQL Exception: " + sqle.getMessage()); System.out.println("insertSQLXML: SQL State: " + sqle.getSQLState()); System.out.println("insertSQLXML: SQL Error Code: " + sqle.getErrorCode()); } } >}:TB>}5wKgN+D~PD}]ek XML PP#}]Gw*~xF}]e kD,rK,}]b~qw'VZ?`k# Z 10 B &CLr`LM}L'V 229 public void insertBinStream(Connection conn) { PreparedStatement insertStmt = null; String sqls = null; int cid = 0; Statement stmt=null; try { sqls = "INSERT INTO CUSTOMER (CID, INFO) VALUES (?, ?)"; insertStmt = conn.prepareStatement(sqls); insertStmt.setInt(1, cid); File file = new File(fn); insertStmt.setBinaryStream(2, new FileInputStream(file), (int)file.length()); if (insertStmt.executeUpdate() != 1) { System.out.println("insertBinStream: No record inserted."); } } catch (IOException ioe) { ioe.printStackTrace(); } catch (SQLException sqle) { System.out.println("insertBinStream: SQL Exception: " + sqle.getMessage()); System.out.println("insertBinStream: SQL State: " + sqle.getSQLState()); System.out.println("insertBinStream: SQL Error Code: " + sqle.getErrorCode()); } } >}:TB>}5wKgN+D~PD~xF XML }]ek XML PP# ... SQLXML info = conn.createSQLXML(); OutputStream os = info.setBinaryStream (); FileInputStream fis = new FileInputStream("c7.xml"); int read; while ((read = fis.read ()) != -1) { os.write (read); } PreparedStatement insertStmt = null; String sqls = null; int cid = 1015; sqls = "INSERT INTO MyCustomer (Cid, Info) VALUES (?, ?)"; insertStmt = conn.prepareStatement(sqls); insertStmt.setInt(1, cid); insertStmt.setSQLXML(2, info); insertStmt.executeUpdate(); Z JDBC &CLrPlw XML }] Z JDBC &CLrP,IT9C ResultSet.getXXX r ResultSet.getObject =(S XML PPlw}]# Z JDBC &CLrP,zITS DB2 mD XML PPT XML D>}]DN=lw }]#g{}]~qw'V~xF XML }](I)9/,~xF XML DB2 M'z/ ~qw~xF XML q=D}]),G4zITSmD XML PPT~xF XML } ]DN=lw}]# IT9CBPdP;V# 230 pureXML 8O }g,IT9C SQLXML.getBinaryStream =(r_ SQLXML.getSource =(4lw }]# v 9C ResultSet.getXXX =(x;G ResultSet.getObject 4+}]lw=f]D}]` MP# v 9C ResultSet.getObject =(4lw}],;s+|D}]`M?F*;* DB2Xml `M,"+|8(x DB2Xml Ts#;s9C DB2Xml.getDB2XXX r DB2Xml.getDB2XmlXXX =(4+}]lw=f]Ddv}]`MP# g{z49C'V JDBC 4.0 D IBM Data Server Driver for JDBC and SQLJ f>, G4h*9CKKCZlw XML }]D ResultSet =(M`&Ddv}]`M# m 29. CZlw XML }]D ResultSet =(M}]`M =( dv}]`M ResultSet.getAsciiStream InputStream ResultSet.getBinaryStream InputStream ResultSet.getBytes byte[] ResultSet.getCharacterStream Reader ResultSet.getObject Object ResultSet.getSQLXML SQLXML ResultSet.getString String B m P > K ; ) =(, I T ( } w C b ) =(4 S java.sql.SQLXML r com.ibm.db2.jcc.DB2Xml TsPlw}],T0lw`&Ddv}]`MM XML yw PD`k`M# m 30. SQLXML M DB2Xml =("}]`MT0mSD`kf6 =( dv}]`M QmSD XML Z?`kywD`M SQLXML.getBinaryStream InputStream ^ SQLXML.getCharacterStream Reader ^ SQLXML.getSource Source1 ^ SQLXML.getString String ^ DB2Xml.getDB2AsciiStream InputStream ^ DB2Xml.getDB2BinaryStream InputStream ^ DB2Xml.getDB2Bytes byte[] ^ DB2Xml.getDB2CharacterStream Reader ^ DB2Xml.getDB2String String ^ DB2Xml.getDB2XmlAsciiStream InputStream US-ASCII DB2Xml.getDB2XmlBinaryStream InputStream I getDB2XmlBinaryStream targetEncoding N}8( DB2Xml.getDB2XmlBytes byte[] I DB2Xml.getDB2XmlBytes targetEncoding N}8( DB2Xml.getDB2XmlCharacterStream Reader ISO-10646-UCS-2 DB2Xml.getDB2XmlString String ISO-10646-UCS-2 ": 1. y5XD`I getSource DwCLr8(,+GC`Xk)9 javax.xml.transform.Source# Z 10 B &CLr`LM}L'V 231 g{&CLrT*5XD}]4P XMLSERIALIZE /},G4Z4PC/}.s,b )}]+_P XMLSERIALIZE /}P8(D}]`M,x;G XML }]`M#r K,}/Lr+Q}]w*8(`M4&m,"RavTNNZ?`kyw# >}:TB>}5w+ XML PPD}]lw= SQLXML TsP,;s9C SQLXML.getString =(+}]lw=V{.P# public void fetchToSQLXML(long cid, java.sql.Connection conn) { System.out.println(">> fetchToSQLXML: Get XML data as an SQLXML object " + "using getSQLXML"); PreparedStatement selectStmt = null; String sqls = null, stringDoc = null; ResultSet rs = null; try{ sqls = "SELECT info FROM customer WHERE cid="+cid; selectStmt = conn.prepareStatement(sqls); rs = selectStmt.executeQuery(); // Get metadata // Column type for XML column is the integer java.sql.Types.OTHER ResultSetMetaData meta = rs.getMetaData(); int colType = meta.getColumnType(1); System.out.println("fetchToSQLXML: Column type="+colType); while (rs.next()) { // Retrieve the XML data with getSQLXML. // Then write it to a string with // explicit internal ISO-10646-UCS-2 encoding. java.sql.SQLXML xml = rs.getSQLXML(1); System.out.println (xml.getString()); } rs.close(); } catch (SQLException sqle) { System.out.println("fetchToSQLXML: SQL Exception: " + sqle.getMessage()); System.out.println("fetchToSQLXML: SQL State: " + sqle.getSQLState()); System.out.println("fetchToSQLXML: SQL Error Code: " + sqle.getErrorCode()); } } >}:TB>}5wKgN+ XML PPD}]lw= SQLXML TsP,;sgN9 C SQLXML.getBinaryStream =(+C}]w*~xF}]lw=dkwP# String sql = "SELECT INFO FROM Customer WHERE Cid=’1000’"; PreparedStatement pstmt = con.prepareStatement(sql); ResultSet resultSet = pstmt.executeQuery(); // Get the result XML as a binary stream SQLXML sqlxml = resultSet.getSQLXML(1); InputStream binaryStream = sqlxml.getBinaryStream(); >}:TB>}5w+ XML PPD}]lw= String d?P# public void fetchToString(long cid, java.sql.Connection conn) { System.out.println(">> fetchToString: Get XML data " + "using getString"); PreparedStatement selectStmt = null; String sqls = null, stringDoc = null; ResultSet rs = null; 232 pureXML 8O try{ sqls = "SELECT info FROM customer WHERE cid="+cid; selectStmt = conn.prepareStatement(sqls); rs = selectStmt.executeQuery(); // Get metadata // Column type for XML column is the integer java.sql.Types.OTHER ResultSetMetaData meta = rs.getMetaData(); int colType = meta.getColumnType(1); System.out.println("fetchToString: Column type="+colType); while (rs.next()) { stringDoc = rs.getString(1); System.out.println("Document contents:"); System.out.println(stringDoc); } catch (SQLException sqle) { System.out.println("fetchToString: SQL Exception: " + sqle.getMessage()); System.out.println("fetchToString: SQL State: " + sqle.getSQLState()); System.out.println("fetchToString: SQL Error Code: " + sqle.getErrorCode()); } } >}:TB>}5w+ XML PPD}]lw= DB2Xml TsP,;s9C DB2Xml.getDB2XmlString =(4+}]lw= String TsP,"RmSK{O ISO- 10646-UCS-2 `kf6D XML yw# public void fetchToDB2Xml(long cid, java.sql.Connection conn) { System.out.println(">> fetchToDB2Xml: Get XML data as a DB2XML object " + "using getObject"); PreparedStatement selectStmt = null; String sqls = null, stringDoc = null; ResultSet rs = null; try{ sqls = "SELECT info FROM customer WHERE cid="+cid; selectStmt = conn.prepareStatement(sqls); rs = selectStmt.executeQuery(); // Get metadata // Column type for XML column is the integer java.sql.Types.OTHER ResultSetMetaData meta = rs.getMetaData(); int colType = meta.getColumnType(1); System.out.println("fetchToDB2Xml: Column type="+colType); while (rs.next()) { // Retrieve the XML data with getObject, and cast the object // as a DB2Xml object. Then write it to a string with // explicit internal ISO-10646-UCS-2 encoding. com.ibm.db2.jcc.DB2Xml xml = (com.ibm.db2.jcc.DB2Xml) rs.getObject(1); System.out.println (xml.getDB2XmlString()); } rs.close(); } catch (SQLException sqle) { System.out.println("fetchToDB2Xml: SQL Exception: " + sqle.getMessage()); System.out.println("fetchToDB2Xml: SQL State: " + sqle.getSQLState()); Z 10 B &CLr`LM}L'V 233 System.out.println("fetchToDB2Xml: SQL Error Code: " + sqle.getErrorCode()); } } Z Java &CLrPwC_P XML N}D}L Java &CLrITwC DB2 for Linux, UNIX, and Windows r DB2 for z/OS }] 4P_P XML N}Df"}L# TZ>z SQL }L,f"}L(ePD XML N}* XML `M#xTZ DB2 for Linux, UNIX, and Windows}]4ODb?f"}LMC'(eD/},}L(ePD XML N}* XML AS CLOB `M#1wC_P XML N}Df"}LrC'(eD /}1,h*ZwCodP9Cf]}]`M# *S JDBC LrPwC_P XML dkN}D}L,k9C java.sql.SQLXML r com.ibm.db2.jcc.DB2Xml `MDN}#*"a XML dvN},k+b)N}"a* java.sql.Types.SQLXML r com.ibm.db2.jcc.DB2Types.XML `M#(;Fv9C com.ibm.db2.jcc.DB2Xml M com.ibm.db2.jcc.DB2Types.XML `M#) >}:+wC_P}v XML N}(IN"OUT M INOUT N})Df"}LD JDBC Lr#K>}h*9C JDBC 4.0 r|_f># java.sql.SQLXML in_xml = xmlvar; java.sql.SQLXML out_xml = null; java.sql.SQLXML inout_xml = xmlvar; // Declare an input, output, and // INOUT XML parameter Connection con; CallableStatement cstmt; ResultSet rs; ... cstmt = con.prepareCall("CALL SP_xml(?,?,?)"); // Create a CallableStatement object cstmt.setObject (1, in_xml); // Set input parameter cstmt.setObject (3, inout_xml); // Set inout parameter cstmt.registerOutParameter (2, java.sql.Types.SQLXML); // Register out and input parameters cstmt.registerOutParameter (3, java.sql.Types.SQLXML); cstmt.executeUpdate(); // Call the stored procedure out_xml = cstmt.getSQLXML(2); // Get the OUT parameter value inout_xml = cstmt.getSQLXML(3); // Get the INOUT parameter value System.out.println("Parameter values from SP_xml call: "); System.out.println("Output parameter value "); MyUtilities.printString(out_xml.getString()); // Use the SQLXML.getString // method to convert the out_xml // value to a string for printing. // Call a user-defined method called // printString (not shown) to print // the value. System.out.println("INOUT parameter value "); MyUtilities.printString(inout_xml.getString()); // Use the SQLXML.getString // method to convert the inout_xml // value to a string for printing. // Call a user-defined method called // printString (not shown) to print // the value. *S SQLJ LrPwC_P XML N}D}L,k9C java.sql.SQLXML r com.ibm.db2.jcc.DB2Xml `MDN}# 234 pureXML 8O >}:+wC_P}v XML N}(IN"OUT M INOUT N})Df"}LD SQLJ Lr#K>}h*9C JDBC 4.0 r|_f># java.sql.SQLXML in_xml = xmlvar; java.sql.SQLXML out_xml = null; java.sql.SQLXML inout_xml = xmlvar; // Declare an input, output, and // INOUT XML parameter ... #sql [myConnCtx] {CALL SP_xml(:IN in_xml, :OUT out_xml, :INOUT inout_xml)}; // Call the stored procedure System.out.println("Parameter values from SP_xml call: "); System.out.println("Output parameter value "); MyUtilities.printString(out_xml.getString()); // Use the SQLXML.getString // method toconvert the out_xml value // to a string for printing. // Call a user-defined method called // printString (not shown) to print // the value. System.out.println("INOUT parameter value "); MyUtilities.printString(inout_xml.getString()); // Use the SQLXML.getString // method to convert the inout_xml // value to a string for printing. // Call a user-defined method called // printString (not shown) to print // the value. SQLJ SQLJ &CLrPD XML }] Z SQLJ &CLrP,IT+}]f"Z XML PP"S XML PPlw}]# Z DB2 mP,XML ZC}]`MCZ+ XML }]T;iICwNa9Da9/Z cN=f"ZPP# SQLJ &CLrIT9CBPdP;Vq=+ XML }]"MA}]~qwr_SPl w XML }]: v D> XML }] v ~xF XML }](I)9/,~xF XML DB2 M'z/~qw~xF XML q= D}],g{}]~qw'VC}]) Z SQLJ &CLrP,zIT4PBPYw: v 9C INSERT"UPDATE r MERGE od+{v XML D5f"Z XML PP# v 9C%P SELECT odr|zwS XML PPlw{v XML D5# v (}TB=(S XML PPDD5Zlw;vrP:9C SQL XMLQUERY /}Z }]bPlwCrP,;s9C%P SELECT odr|zw+QrP/D XML V {.}]lw=&CLrd?P# v (}TB=(S XML PPDD5Zlw;vrP:9C0fmSKV{. “XQUERY”D XQuery mo=4+CrPD*Xlw=}]bPDa{mP,xa{ mPD?;PCrPPD;n#;s9C%P SELECT odr|zw4+} ]lw=&CLrd?P# Z 10 B &CLr`LM}L'V 235 v (}TB=(S XML PPDD5Zlw;vw*C'(eDmDrP:9C SQL XMLTABLE /}4(e"lwa{m#;s9C%P SELECT odr|zw4+ a{mPD}]lw=&CLrd?P# v IT+ XML }]w*D> XML }]xP|Brlw#r_,TZk'V~xF XML }]D}]~qwD,S,IT+ XML }]w*~xF XML }]xP|B rlw# TZ}]lw,IT9C Datasource r Connection tT xmlFormat 4XFlw= D}]Dq=GD> XML 9G~xF XML# TZ|B XML PPD}],xmlFormat ;P'{#g{dk}]G~xF XML } ],"R}]~qw;'V~xF XML }],G4a+dk}]*;*D> XML }]#qr,+;axP*;# XML }]Dq=TZ&CLrG8wD#Z DB2 for z/OS }]~qwOf"Ml w~xF XML }]h* IBM Data Server Driver for JDBC and SQLJ V4.9 r| _f>#Z DB2 for Linux, UNIX, and Windows }]~qwOf"Mlw~xF XML }]h* IBM Data Server Driver for JDBC and SQLJ V4.11 r|_f># IT9C JDBC 4.0 java.sql.SQLXML Ts4lwM|B XML PPD}]#g{wC ng ResultSetMetaData.getColumnType .`D*}]=(,G4aT XML P`M5 X{}5 java.sql.Types.SQLXML# SQLJ &CLrPD XML P|B Z SQLJ &CLrP,zIT9C XML D>}]Z DB2 }]~qwOmD XML P P|Brek}]#g{}]~qw'V~xF XML }](I)9/,~xF XML DB2 M'z/~qw~xF XML q=D}]),G4zIT9C~xF XML }]Z mD XML PP|Brek}]# ITC4|B XML PDwzmo=}]`M|(: v java.sql.SQLXML(h* SDK for Java V6 r|Bf>,T0 IBM Data Server Driver for JDBC and SQLJf> 4.0 r|Bf>) v com.ibm.db2.jcc.DB2Xml(;Fv9C) v String v byte v Blob v Clob v sqlj.runtime.AsciiStream v sqlj.runtime.BinaryStream v sqlj.runtime.CharacterStream XML }]D`kITS}]>mIz(F*Z?`k}]),2ITSb?4Iz(F *b?`k}])#w*~xF}]"MA}]b~qwD XML }];1wZ?`k D}]4&m#w*V{}]"MA}]4D XML }];1wb?`kD}]4& m#JVM D1!`kGb?`k# Java &CLrDb?`k4&mZ?`kkb?`k.dD;f] T: v g{}]4G DB2 for Linux, UNIX, and Windows,G4Zb?`kkZ?`k; f]DivB,}]4+zzms,}Gb?`kMZ?`k}:Y(z9CTBod+ String wzmo= xmlString PD}]ek=;vmD XML PP#xmlString GV{`M,rK,^[|Gq_PZ?`kf6,<+9C| Db?`k# #sql [ctx] {INSERT INTO CUSTACC VALUES (1, :xmlString)}; >}:Y(z+}]S xmlString 4F=9C CP500 `kDVZ}iP#}]|, XML ywM CP500 D`kyw#;s,+ byte[] wzmo=PD}]ek=;vm D XML PP# byte[] xmlBytes = xmlString.getBytes("CP500"); #sql[ctx] {INSERT INTO CUSTACC VALUES (4, :xmlBytes)}; VZV{.;O*GZZ?`kD}]#g{h*,}]+S|DZ?`k=8*; * UTF-8,"ICVcq=f"Z}]4O# >}:Y(z+}]S xmlString 4F=9C US-ASCII `kDVZ}iP#;s,9 l;v sqlj.runtime.AsciiStream wzmo=,"+ sqlj.runtime.AsciiStream wzmo= PD}]ek=}]4OD;vmD XML PP# byte[] b = xmlString.getBytes("US-ASCII"); java.io.ByteArrayInputStream xmlAsciiInputStream = new java.io.ByteArrayInputStream(b); sqlj.runtime.AsciiStream sqljXmlAsciiStream = new sqlj.runtime.AsciiStream(xmlAsciiInputStream, b.length); #sql[ctx] {INSERT INTO CUSTACC VALUES (4, :sqljXmlAsciiStream)}; sqljXmlAsciiStream G;Vw`M,rK+9C|DZ?`k#}]+S|DZ?`k* ;* UTF-8 `k,"ICVcq=f"Z}]4O# > } : sqlj.runtime.CharacterStream w z m o = : Y ( z 9 l ; v sqlj.runtime.CharacterStream wzmo=,"+ sqlj.runtime.CharacterStream wzmo= PD}]ek=;vmD XML PP# java.io.StringReader xmlReader = new java.io.StringReader(xmlString); sqlj.runtime.CharacterStream sqljXmlCharacterStream = new sqlj.runtime.CharacterStream(xmlReader, xmlString.length()); #sql [ctx] {INSERT INTO CUSTACC VALUES (4, :sqljXmlCharacterStream)}; sqljXmlCharacterStream GV{`M,rK,^[|Gq_PZ?`kf6,<+9C| Db?`k# >}:Y(z+;vD5S XML Plw= java.sql.SQLXML wzmo=P,"+} ]ek=;vmD XML PP# Z 10 B &CLr`LM}L'V 237 java.sql.ResultSet rs = s.executeQuery ("SELECT * FROM CUSTACC"); rs.next(); java.sql.SQLXML xmlObject = (java.sql.SQLXML)rs.getObject(2); #sql [ctx] {INSERT INTO CUSTACC VALUES (6, :xmlObject)}; lw}].s,|T;IC UTF-8 `k#rK,1z+C}]ekm;v XML P1, ;axP*;# >}:Y(z+;vD5S XML Plw= com.ibm.db2.jcc.DB2Xml wzmo=P, "+}]ek=;vmD XML PP# java.sql.ResultSet rs = s.executeQuery ("SELECT * FROM CUSTACC"); rs.next(); com.ibm.db2.jcc.DB2Xml xmlObject = (com.ibm.db2.jcc.DB2Xml)rs.getObject(2); #sql [ctx] {INSERT INTO CUSTACC VALUES (6, :xmlObject)}; lw}].s,|T;IC UTF-8 `k#rK,1z+C}]ekm;v XML P1, ;axP*;# Z JDBC &CLrPlw XML }] Z SQLJ &CLrP,S}]bmD XML PPlw}]1,dv}]XkQT=r~ =rP/# ITC4S XML PPlw}]Dwzmo=r|zw}]`M|(: v java.sql.SQLXML(h* SDK for Java V6 r|Bf>,T0 IBM Data Server Driver for JDBC and SQLJf> 4.0 r|Bf>) v com.ibm.db2.jcc.DB2Xml(;Fv9C) v String v byte[] v sqlj.runtime.AsciiStream v sqlj.runtime.BinaryStream v sqlj.runtime.CharacterStream g{Zlw}].0&CLr;wC XMLSERIALIZE /},G4}]+S UTF-8 * ;*V{}]`MDb?&CLr`k,r_*;*~xF}]`MDZ?`k#; a m S XML y w # g { w z m o =G; v java.sql.SQLXML r com.ibm.db2.jcc.DB2Xml `MDTs,G4h*wCd{=(4SKTsPlw}]# zwCD=(+7(dv}]D`kT0GqmSK_P`kf6D XML yw# B m P > K ; ) =(, I T ( } w C b ) =(4 S java.sql.SQLXML r com.ibm.db2.jcc.DB2Xml TsPlw}],T0lw`&Ddv}]`MM XML yw PD`k`M# m 31. SQLXML M DB2Xml =("}]`MT0mSD`kf6 =( dv}]`M QmSD XML Z?`kywD`M SQLXML.getBinaryStream InputStream ^ SQLXML.getCharacterStream Reader ^ SQLXML.getSource Source ^ SQLXML.getString String ^ DB2Xml.getDB2AsciiStream InputStream ^ DB2Xml.getDB2BinaryStream InputStream ^ 238 pureXML 8O m 31. SQLXML M DB2Xml =("}]`MT0mSD`kf6 (x) =( dv}]`M QmSD XML Z?`kywD`M DB2Xml.getDB2Bytes byte[] ^ DB2Xml.getDB2CharacterStream Reader ^ DB2Xml.getDB2String String ^ DB2Xml.getDB2XmlAsciiStream InputStream US-ASCII DB2Xml.getDB2XmlBinaryStream InputStream I getDB2XmlBinaryStream targetEncoding N}8( DB2Xml.getDB2XmlBytes byte[] I DB2Xml.getDB2XmlBytes targetEncoding N}8( DB2Xml.getDB2XmlCharacterStream Reader ISO-10646-UCS-2 DB2Xml.getDB2XmlString String ISO-10646-UCS-2 g{&CLrT*5XD}]4P XMLSERIALIZE /},G4Z4PC/}.s,b )}]+_P XMLSERIALIZE /}P8(D}]`M,x;G XML }]`M#r K,}/Lr+Q}]w*8(`M4&m,"RavTNNZ?`kyw# >}:Y(z+ XML PPD}]lw= String wzmo=P# #sql iterator XmlStringIter (int, String); #sql [ctx] siter = {SELECT C1, CADOC from CUSTACC}; #sql {FETCH :siter INTO :row, :outString}; String `MGV{`M,rK,}]+S UTF-8 *;*b?`k(bG1! JVM ` k),"R5X1;xNN XML yw# >}:Y(z+ XML PPD}]lw= byte[] wzmo=P# #sql iterator XmlByteArrayIter (int, byte[]); XmlByteArrayIter biter = null; #sql [ctx] biter = {SELECT c1, CADOC from CUSTACC}; #sql {FETCH :biter INTO :row, :outBytes}; byte[] `MG~xF`M,rK;a*;9C UTF-8 `kD}],"R}]5X1;x NN XML yw# >}:Y(z+;vD5S XML Plw= java.sql.SQLXML wzmo=P,+zh *~xFwPD}]# #sql iterator SqlXmlIter (int, java.sql.SQLXML); SqlXmlIter SQLXMLiter = null; java.sql.SQLXML outSqlXml = null; #sql [ctx] SqlXmlIter = {SELECT c1, CADOC from CUSTACC}; #sql {FETCH :SqlXmlIter INTO :row, :outSqlXml}; java.io.InputStream XmlStream = outSqlXml.getBinaryStream(); FETCH o d + } ] l w = I C UTF-8 ` k D SQLXML T s P # SQLXML.getBinaryStream +}]f"Z~xFwP# >}:Y(z+;vD5S XML Plw= com.ibm.db2.jcc.DB2Xml wzmo=P, +Gzh*_P XML ywDVZV{.PD}],x XML yw|, UTF-8 DZ? `kf6# #sql iterator DB2XmlIter (int, com.ibm.db2.jcc.DB2Xml); DB2XmlIter db2xmliter = null; com.ibm.db2.jcc.DB2Xml outDB2Xml = null; Z 10 B &CLr`LM}L'V 239 #sql [ctx] db2xmliter = {SELECT c1, CADOC from CUSTACC}; #sql {FETCH :db2xmliter INTO :row, :outDB2Xml}; byte[] byteArray = outDB2XML.getDB2XmlBytes("UTF-8"); FETCH od+}]lw=IC UTF-8 `kD DB2Xml TsP#_P UTF-8 N}D getDB2XmlBytes =(+mS_P UTF-8 `kf6D XML yw,"+}]f"ZV Z}iP# PHP IBM }]~qwD PHP &CLr*" PHP:,D>$&mw (PHP) G;VbMM`LoT,c:CZ*" Web &CLr# PHP Q-I*CZ Web *"D;VwPoT,r*|WZ'0,w*a)5CDbv =8,"R'V Web &CLrPh*Dn#{&\# PHP G;V#i/oT,9z\;(}9C)94(eIC&\#b))9ITr/n gBPNq:A4M&m XML,4( SOAP M'zM~qw,T0T~qwM/@w .dD(ExPS\#;x,PHP DnwPD)9a)KT}]bDA4CJ(,r K,zIT\aIX4(/,}]b}/D Web >c# IBM a)KP>D PHP )94CJ IBM }]~qw}]b: ibm_db2 ;v}L &CLr`LSZ(API),}K4P}#D4("A!"|BM4k }]bYwTb,9a)KT}]b*}]Ds?CJ#IT9C PHP 4 r PHP 5 4`k ibm_db2 )9#K)9GI IBM `4",$M'VD;v) 9# pdo_ibm ;vCZ PHP }]Ts(PDO))9D}/Lr,|(} PHP 5.1 P}kD frTsDj<}]bSZ4CJ IBM }]~qw}]b# b))9r|_f>,S= IBM DB2 V9.7 for Linux, UNIX, and Windows#zI T(}"v php--re ibm_db2 |nli ibm_db2 )9Df># 9ITS PHP )9+Cb (PECL)(x7*:http://pecl.php.net/)qCnBf>D ibm_db2 M pdo_ibm# PHP &CLrITCJP>D IBM }]~qw}]b: v IBM DB2 V9.1 for Linux, UNIX, and Windows FP2 M|_f> v IBM DB2 Universal Database™(DB2 UDB)V8 for Linux, UNIX, and Windows FP15 M|_f> v k IBM DB2 for IBM i V5R3 D6L,S v k IBM DB2 for IBM i V5.4 M|_f>D6L,S v k IBM DB2 for z/OS V8 M|_f>D6L,S Z}v)9“3; ODBC”-HMa)KT DB2 }]b53DCJ(#+G,TZBD &CLr,I9C ibm_db2 M pdo_ibm,bGr*|GZT\MH(T=fc http://www.php.net/ 1. |( Windows ~xFD~#Q-Tf PHP ;pa)Ds`} Linux V"xPK $`k# Perl pureXML M Perl DBD::DB2 }/Lr'V DB2 pureXML#TZ pureXML D'VJm(} DBD::DB2 }/Lr|1SXCJ}],"(}Z&CLrk}]b.da)|`8w(E4o zuY&CLr_-# hz pureXML 'V,I1S+ XML D5ek= DB2 }]bP#r* pureXML b vwaZz+ XML }]ek=}]bP1T/KP,yT&CLr;Yh*bv XML D5#+D5bvEZ&CLrb?xPIDx&CLrT\"5M,$$w?#9 C DBD::DB2 }/Lrlw XML f"}]2\r%;I9C BLOB rG<4CJ} ]# Z 10 B &CLr`LM}L'V 241 PX DB2 Perl }]bSZT0gNBXnB DBD::DB2 }/LrDE",kND http:// www.ibm.com/software/data/db2/perl# >} C>}G;v9C pureXML D Perl Lr: #!/usr/bin/perl use DBI; use strict ; # Use DBD:DB2 module: # to create a simple DB2 table with an XML column # Add one row of data # retreive the XML data as a record or a LOB (based on $datatype). # NOTE: the DB2 SAMPLE database must already exist. my $database=’dbi:DB2:sample’; my $user=’’; my $password=’’; my $datatype = "record" ; # $datatype = "LOB" ; my $dbh = DBI->connect($database, $user, $password) or die "Can’t connect to $database: $DBI::errstr"; # For LOB datatype, LongReadLen=0--nodata is retrieved on initial fetch $dbh->{LongReadLen}=0if$datatype eq "LOB" ; # SQL CREATE TABLE to create test table my $stmt = "CREATE TABLE xmlTest (id INTEGER, data XML)"; my $sth = $dbh->prepare($stmt); $sth->execute(); #insert one row of data into table insertData() ; # SQL SELECT statement returns home phone element from XML data $stmt = qq( SELECT XMLQUERY (’ \$d/*:customerinfo/*:phone[\@type = "home"] ’ passing data as "d") FROM xmlTest ); # prepare and execute SELECT statement $sth = $dbh->prepare($stmt); $sth->execute(); # Print data returned from select statement if($datatype eq "LOB") { printLOB() ; } else { printRecord() ; } # Drop table $stmt = "DROP TABLE xmlTest" ; $sth = $dbh->prepare($stmt); $sth->execute(); warn $DBI::errstr if $DBI::err; 242 pureXML 8O $sth->finish; $dbh->disconnect; ############## sub printRecord { print "output data as as record\n" ; while( my @row = $sth->fetchrow ) { print $row[0] . "\n"; } warn $DBI::errstr if $DBI::err; } sub printLOB { print "output as Blob data\n" ; my $offset = 0; my $buff=""; $sth->fetch(); while( $buff = $sth->blob_read(1,$offset,1000000)) { print $buff; $offset+=length($buff); $buff=""; } warn $DBI::errstr if $DBI::err; } sub insertData { # insert a row of data my $xmlInfo = qq(\’ Bill Jones 5 Redwood Toronto Ontario M6W 1E9 416-555-9911 416-555-1212 \’) ; my $catID = 1011 ; # SQL statement to insert data. my $Sql = qq( INSERT INTO xmlTest (id, data) VALUES($catID, $xmlInfo ) ); $sth = $dbh->prepare( $Sql ) or die "Can’t prepare statement: $DBI::errstr"; my $rc = $sth->execute or die "Can’t execute statement: $DBI::errstr"; Z 10 B &CLr`LM}L'V 243 # check for problems warn $DBI::errstr if $DBI::err; } Perl PD}]b,S DBD::DB2 }/Lr'VI DBI API (eDj<}]b,S/}# *9 Perl \;0k DBI #i,XkZ&CLrP|, use DBI; P: 14UP>Do(9C DBI->connect od44(}]bdz1,DBI #i+T/0k DBD::DB2 }/Lr: my $dbhandle = DBI->connect(’dbi:DB2:dsn’, $userID, $password); dP: $dbhandle m> connect ody5XD}]bdz dsn TZ>X,S,dsn m>Z DB2 }]b?;vj{D,SV{.,dP|(CZ,SA6Lwz Dwz{"KZE"-i"C'j6M\k $userID m>CZ,SA}]bDC'j6 $password m>CZ,SA}]bDC'j6D\k PX DBI API D|`E",kND http://search.cpan.org/~timb/DBI/DBI.pmhttp:// search.cpan.org/~timb/DBI/DBI.pm# >} >} 1:,SA>XwzOD}]b(M'zM~qw;Z,;$w>O) use DBI; $DATABASE = ’dbname’; $USERID = ’username’; $PASSWORD = ’password’; my $dbh = DBI->connect("dbi:DB2:$DATABASE", $USERID, $PASSWORD, {PrintError => 0}) or die "Couldn’t connect to database: " . DBI->errstr; $dbh->disconnect; >} 2:,SA6LwzOD}]b(M'zM~qw;Z;,$w>O) use DBI; $DSN="DATABASE=sample; HOSTNAME=host; PORT=60000; PROTOCOL=TCPIP; UID=username; PWD=password"; my $dbh = DBI->connect("dbi:DB2:$DSN", $USERID, $PASSWORD, {PrintError => 0}) or die "Couldn’t connect to database: " . DBI->errstr; $dbh->disconnect; 244 pureXML 8O Perl ^F 3)^FJCZ9C Perl *"&CLr1ICD'V# Perl DBI #iv'V/, SQL#1zXk`N4P3vod1,I(}"v prepare wC4TCodxP$`k,SxDx Perl &CLrDT\# Perl ;'V`_L}]bCJ# PX$w>Oy20 DBD::DB2 }/Lrf>D^FD10E",kND DBD::DB2 } /Lr|PD CAVEATS D~# }L SQL }L SQL }LPD XML M XQuery 'V SQL }L'V9C XML }]`MDN}Md?#Z SQL odPITq9CNNd{ }]`MDd?;y9C|G#mb,IT+ XML }]`MDd?w*N}+]x XMLEXISTS"XMLQUERY M XMLTABLE mo=PD XQuery mo=# TB>}5wK SQL }LPD XML N}Md?Dyw"9CM35: CREATE TABLE T1(C1 XML) % CREATE PROCEDURE proc1(IN parm1 XML, IN parm2 VARCHAR(32000)) LANGUAGE SQL BEGIN DECLARE var1 XML; /* check if the value of XML parameter parm1 contains an item with a value less than 200 */ IF(XMLEXISTS(’$x/ITEM[value < 200]’ passing by ref parm1 as "x"))THEN /* if it does, insert the value of parm1 into table T1 */ INSERT INTO T1 VALUES(parm1); END IF; /* parse parameter parm2’s value and assign it to a variable */ SET var1 = XMLPARSE(document parm2 preserve whitespace); /* insert variable var1 into table T1 INSERT INTO T1 VALUES(var1); END % ZK>}P,P;v_P XML PDm T1#SQL }LS\}]`M* XML D=vN }:parm1 M parm2#Z SQL }LP,;v XML d?;yw* var1# SQL }LD_-+li XML N} parm1 D5Gq|,;v5!Z 200 Dn#g{ |,by;n,G4a+C XML 51Sek= T1 mD C1 PP# ;s,+9C XMLPARSE /}4bv parm2 N}D5,"+C5w* XML d? var1 D35#;s,9a+C XML d?5ek= T1 mD C1 PP# Z 10 B &CLr`LM}L'V 245 T XQuery Yw5VXFw_-bn\&,9C\]W*"C4i/MCJf"Z}] bPD XML }]D4Sc(# SQL }LP XQuery mo=DNj SQL }L'VZ XQuery mo=O(eNj#XQuery mo=ODNjJmzTCmo =5XD XQuery rPD*XxP|z# IT2,r/,(e SQL odODNj,+;\/,(e XQuery mo=ODNj# */,yw;vNj,h*yw;v CHAR r VARCHAR `MDd?,T|,+C 4(eNja{/D XQuery mo=#Xk<8C XQuery mo=.sE\r*NjM bva{/# TBG;v SQL }L>},|+* XQuery mo=/,yw;vNj"r*CNj" Cf XML }]: CREATE PROCEDURE xmlProc(IN inCust XML, OUT resXML XML) SPECIFIC xmlProc LANGUAGE SQL BEGIN DECLARE SQLSTATE CHAR(5); DECLARE stmt_text VARCHAR (1024); DECLARE customer XML; DECLARE cityXml XML; DECLARE city VARCHAR (100); DECLARE stmt STATEMENT; DECLARE cur1 CURSOR FOR stmt; -- Get the city of the input customer SET cityXml = XMLQUERY(’$cust/customerinfo//city’ passing inCust as "cust"); SET city = XMLCAST(cityXml as VARCHAR(100)); -- Iterate over all the customers from the city using an XQUERY cursor -- and collect the customer name values into the output XML value SET stmt_text = ’XQUERY for $cust in db2-fn:xmlcolumn("CUSTOMER.INFO") /*:customerinfo/*:addr[*:city= "’ || city ||’"] return {$cust/../@Cid}{$cust/../*:name}’; -- Use the name of the city for the input customer data as a prefix SET resXML = cityXml; PREPARE stmt FROM stmt_text; OPEN cur1; FETCH cur1 INTO customer; WHILE (SQLSTATE = ’00000’) DO SET resXML = XMLCONCAT(resXML, customer); FETCH cur1 INTO customer; END WHILE; set resXML = XMLQUERY(’ {$res} ’ passing resXML as "res"); END K SQL }L+U/Zm{ CUSTOMER P(eDM'Dj6MU{,b)M'k+ XML }]w*dkN}4a)DG)M'&Z,;GP# IT4gBy>4P CALL od4wCK SQL }L: 246 pureXML 8O CALL xmlProc(xmlparse(document ’ Jim Noodle 25 EastCreek Markham Ontario N9C-3T6 905-566-7258 ’ PRESERVE WHITESPACE),?) g{4(KK SQL }L"RT SAMPLE }]bKPK|,Ma5X=vM'D XML }]# IZ XML 5;'VN}jG,KV^TD;vd(=(GZ|(;vr`vV?d? 5DQ"Cod,Nb?9l;v/, SQL od# }g: DECLARE person_name VARCHAR(128); SET person_name = "Joe"; SET stmt_text = ’XQUERY for $fname in db2-fn:sqlquery ("SELECT doc FROM T1 WHERE DOCID=1")//fullname where $fname/first = ’’’ person_name || ’’’; K>}Z|, SQL +i/D XQuery odDd?35P5X;va{/#Ca{/| ,{V* Joe DK1D+{#S&\O45,SQL ?V+S T1 mD doc PP!qj 6* 1 D XML D5#;s,XQuery ?VZ XML D5P!q first 5* Joe D fullname 5# d5MXvT SQL }LPD XML N}Md?5DwC SQL }LPDd5MXva0l}]`M* XML DN}Md?D5#Z4P SQL } LZd,;)4Pd5rXvYw,* XML N}M XML d?8(D5M;YIC# Z4Pd5rXvYw.s,g{"T}C XML }]`MD SQL d?r SQL N}, G4+"zms(SQL1354N, 560CE)# *Z4Pd5rXvYw.sI&X}C XML N}Md?,XkWH*|G8(B 5# 1+ ROLLBACK M COMMIT odmSA SQL }L1,&} TB>}/}G;vZ* SQL j?/},|9C XML }]`Mw*dkN}Md?# C/}+9C XQuery mo=S XML D5Pi! phone number *X"5XC phone number *X: CREATE FUNCTION phone_number ( dept_doc XML ) RETURNS XML LANGUAGE SQL NO EXTERNAL ACTION BEGIN ATOMIC DECLARE tmp_xml XML; IF (XMLEXISTS(’$test/department/phone’ passing by ref dept_doc as "test")) THEN SET tmp_xml = XMLQUERY(’document {{$doc/department/phone}}’ PASSING dept_doc as "doc"); ELSE SET tmp_xml = XMLPARSE(document ’N/A’); END IF; RETURN tmp_xml; END TB SELECT od+9C PHONE_NUMBER /}S_P01E"DmPD XML D 5Plwg0Ek# SELECT PHONE_NUMBER(info) FROM employees WHERE empid = 12356 K SELECT odY(Kmk9CTB CREATE TABLE od4(Dm`F,"RKm |,k9CTB INSERT odekDE"`FD}]: CREATE TABLE employees (empid BIGINT, info XML ) INSERT INTO EMPLOYEES VALUES ( 12356, ’ 12356 555-123-4567 ’) Z9COvmME"DivB,K SELECT od+5XTBg0EkE": 555-123-4567 Z*M SQL /}M`kM SQL /} SQL /}PTB=V5V`M:Z*M SQL /}M`kM SQL /}# Z*M SQL /}(#Ia)nQT\#+G,|G;'V`kM SQL /}'VD3 ) SQL PL oT&\M}]`M#b)&\|(: v CASE od 248 pureXML 8O v REPEAT od v Nj&m v /, SQL v u~&mLr +} v Z*M/} create function F1 (N integer) returns integer deterministic no external action contains sql returnN*10 @ create function F2 (N integer) returns integer deterministic no external action contains sql begin atomic ifN<5then returnN*10 else returnN*20 end if; end @ v `kM/} create function F3 (N integer) returns integer deterministic no external action contains sql begin ifN<5then returnN*10 else returnN*20 end if; end @ Z 10 B &CLr`LM}L'V 249 create function F4 (N integer) returns integer deterministic no external action contains sql begin not atomic ifN<5then returnN*10 else returnN*20 end if; end @ b?}L b?}LPD XML }]`M'V 3)`LoT`4Db?}LM/}'V XML }]`MDN}Md?# 9CBP`LoT`4Db?}LM/}'V XML }]`MDN}Md?: v C v C++ v COBOL v Java v .NET CLR oT b? OLE M OLEDB }L;'V}]`M* XML DN}# XML }]`M5Zb?}LzkPDm>==k CLOB }]`MDm>==`,# 1yw}]`M* XML Db?}LN}1,+C4Z}]bP4(}LD CREATE PROCEDURE M CREATE FUNCTION odXk8(*+ XML }]`Mw* CLOB }]`M4f"#CLOB 5Ds!&CkI XML N}m>D XML D5Ds!HO S|# TB CREATE PROCEDURE odT>(} C `LoT"9C XML N} parm1 5 VDb?}LD CREATE PROCEDURE od: CREATE PROCEDURE myproc(IN parm1 XML AS CLOB(2M), IN parm2 VARCHAR(32000)) LANGUAGE C FENCED PARAMETER STYLE SQL EXTERNAL NAME ’mylib!myproc’; Z4(b? UDF 1fZ`FD"bBn,gTB>}Py>: CREATE FUNCTION myfunc (IN parm1 XML AS CLOB(2M)) RETURNS SMALLINT LANGUAGE C PARAMETER STYLE SQL DETERMINISTIC NOT FENCED NULL CALL NO SQL NO EXTERNAL ACTION EXTERNAL NAME ’mylib1!myfunc’ 250 pureXML 8O + XML }]w* IN"OUT r INOUT N}+]Af"}L1,+_e/C}]#g {9CDG Java f"}L,G4I\h*y] XML Td?D}?Ms!,T0}Z ""4PDb?f"}L}4vSQs!(java_heap_sz dCN})# Zb?}LzkP,+4U}]b&CLrPD`,==4CJ"hCM^D XML N }Md?5# * Java }L8(}/Lr *"MwC Java }Lh*8( JDBC r SQLJ }/Lr# Java }L9C IBM Data Server Driver for JDBC and SQLJ V4.0# IBM Data Server Driver for JDBC and SQLJ V4.0 D db2jcc4.jar |(;) JDBC V4.0 &\#DB2 V9.5 0|_f>'VC}/Lr# 1!ivB,DB2 }]b539C IBM Data Server Driver for JDBC and SQLJ#g { Java }L|,BPZ],G4K}/LrGX8m~: v }]`M* XML DN} v }]`M* XML Dd? v T XML }]D}C v T XML /}D}C v NNd{>z XML &\?~ >}:Java(JDBC)}LPD XML M XQuery 'V ;)zKbK Java }LDy!*6"9C Java oT"hz JDBC &CLr`LSZ (API)4`LT0 XQuery,MIT*<4("9CIC4i/ XML }]D Java } L# K Java }L>}5wK: v N}y= JAVA }LD CREATE PROCEDURE od v N}y= JAVA }LD4zk v }]`M XML DdkMdvN} v Zi/P9C XML dkN} v + XQuery Da{(;v XML 5)w*dvN}D35 v + SQL odDa{(;v XML 5)w*dvN}D35 Hvu~ Z9CK Java }L>}.0,zI\h*DABPwb: v Java }L v }L v 9( Java }Lzk BP>}9C;v{* xmlDataTable Dm,CmD(egBy>"R||,} ]: CREATE TABLE xmlDataTable ( num INTEGER, xdata XML )@ Z 10 B &CLr`LM}L'V 251 INSERT INTO xmlDataTable VALUES (1, XMLPARSE(DOCUMENT ’ car Pontiac Sunfire ’ PRESERVE WHITESPACE)), (2, XMLPARSE(DOCUMENT ’ car Mazda Miata ’ PRESERVE WHITESPACE)), (3, XMLPARSE(DOCUMENT ’ person Mary Vancouver Waterside ’ PRESERVE WHITESPACE)), (4, XMLPARSE(DOCUMENT ’ person Mark Edmonton Oak ’ PRESERVE WHITESPACE)), (5, XMLPARSE(DOCUMENT ’ animal dog ’ PRESERVE WHITESPACE)), (6, NULL), (7, XMLPARSE(DOCUMENT ’ car Ford Taurus ’ PRESERVE WHITESPACE)), (8, XMLPARSE(DOCUMENT ’ person Kim Toronto Elm ’ PRESERVE WHITESPACE)), (9, XMLPARSE(DOCUMENT ’ person Bob Toronto Oak ’ PRESERVE WHITESPACE)), (10, XMLPARSE(DOCUMENT ’ animal bird ’ PRESERVE WHITESPACE))@ }L Z4(zT:D Java }L1,I+TB>}w*N<: v :Java b?zkD~; v Z 253 3D:>} 1:9C XML N}DN}y= JAVA }L; Java b?zkD~ C>}5wK;v Java }L5V#C>}I=?ViI:}LD CREATE PROCE- DURE odMb? Java zk5V,ITy]C}L9(`X*D Java `# |,BP>}D}L5VD Java 4D~{* stpclass.java,CD~|,Z;v{* myJAR D JAR D~P#CD~_PTBq=: 252 pureXML 8O using System; import java.lang.*; import java.io.*; import java.sql.*; import java.util.*; import com.ibm.db2.jcc.DB2Xml; public class stpclass { ... // Java procedure implementations ... } ZD~%?8>K Java `D~} 1:9C XML N}DN}y= JAVA }L K>}T>BPwnZ]: v N}y= JAVA }LD CREATE PROCEDURE od v 9C XML N}DN}y= JAVA }LD Java zk K}LICdkN} inXML,+|,C5DPekmP,9C SQL odM XQuery m o=4 queriesXML }],hC=vdvN} outXML1 M outXML2# CREATE PROCEDURE xmlProc1 ( IN inNUM INTEGER, IN inXML XML as CLOB (1K), OUT out1XML XML as CLOB (1K), OUT out2XML XML as CLOB (1K) ) DYNAMIC RESULT SETS 0 DETERMINISTIC LANGUAGE JAVA PARAMETER STYLE JAVA MODIFIES SQL DATA FENCED THREADSAFE DYNAMIC RESULT SETS 0 PROGRAM TYPE SUB NO DBINFO EXTERNAL NAME ’myJar:stpclass.xmlProc1’@ //************************************************************************* // Stored Procedure: XMLPROC1 // // Purpose: Inserts XML data into XML column; queries and returns XML data // // Parameters: // // IN: inNum -- the sequence of XML data to be insert in xmldata table // inXML -- XML data to be inserted // OUT: out1XML -- XML data to be returned // out2XML -- XML data to be returned // //************************************************************************* public void xmlProc1(int inNum, DB2Xml inXML , DB2Xml[] out1XML, DB2Xml[] out2XML ) throws Exception Z 10 B &CLr`LM}L'V 253 { Connection con = DriverManager.getConnection("jdbc:default:connection"); // Insert data including the XML parameter value into a table String query = "INSERT INTO xmlDataTable (num, inXML ) VALUES ( ?, ? )" ; String xmlString = inXML.getDB2String() ; stmt = con.prepareStatement(query); stmt.setInt(1, inNum); stmt.setString (2, xmlString ); stmt.executeUpdate(); stmt.close(); // Query and retrieve a single XML value from a table using SQL query = "SELECT xdata from xmlDataTable WHERE num=?"; stmt = con.prepareStatement(query); stmt.setInt(1, inNum); ResultSet rs = stmt.executeQuery(); if ( rs.next() ) { out1Xml[0] = (DB2Xml) rs.getObject(1); } rs.close(); stmt.close(); // Query and retrieve a single XML value from a table using XQuery query = "XQUERY for $x in db2-fn:xmlcolumn(\"xmlDataTable.xdata\")/doc where $x/make = \’Mazda\’ return {$x/make}{$x/model}"; stmt = con.createStatement(); rs = stmt.executeQuery( query ); if ( rs.next() ) { out2Xml[0] = (DB2Xml) rs.getObject(1) ; } rs.close(); stmt.close(); con.close(); return ; } >}:C# .NET CLR }LPD XML M XQuery 'V ;)zKbK}LDy!*6".NET (CoTKP1}LD5J"XQuery M XML, MIT*<4( CLR }L"+|Gk XML &\?~dO9C# TB>}5wKN}`M* XML D C# .NET CLR }LT0gN|BMi/ XML } ]# Hvu~ Z9CC CLR }L>}.0,zI\h*DABPEnwb: v .NET (CoTKP1 (CLR) }L v S DB2 |n0Z4( .NET CLR }L v 9C}LDEc BP>}9C;v{* xmlDataTable Dm,CmD(egBy>: CREATE TABLE xmlDataTable ( num INTEGER, 254 pureXML 8O xdata XML ) INSERT INTO xmlDataTable VALUES (1, XMLPARSE(DOCUMENT ’ car Pontiac Sunfire ’ PRESERVE WHITESPACE)), (2, XMLPARSE(DOCUMENT ’ car Mazda Miata ’ PRESERVE WHITESPACE)), (3, XMLPARSE(DOCUMENT ’ person Mary Vancouver Waterside ’ PRESERVE WHITESPACE)), (4, XMLPARSE(DOCUMENT ’ person Mark Edmonton Oak ’ PRESERVE WHITESPACE)), (5, XMLPARSE(DOCUMENT ’ animal dog ’ PRESERVE WHITESPACE)), (6, NULL), (7, XMLPARSE(DOCUMENT ’ car Ford Taurus ’ PRESERVE WHITESPACE)), (8, XMLPARSE(DOCUMENT ’ person Kim Toronto Elm ’ PRESERVE WHITESPACE)), (9, XMLPARSE(DOCUMENT ’ person Bob Toronto Oak ’ PRESERVE WHITESPACE)), (10, XMLPARSE(DOCUMENT ’ animal bird ’ PRESERVE WHITESPACE))@ }L Z4(zT:D C# CLR }L1,I+BP>}w*N<: v :C# b?zkD~; v Z 256 3D:>} 1:9C XML &\?~D C# N}y= GENERAL } L; C# b?zkD~ C>}I=?ViI:}LD CREATE PROCEDURE odMb? C# zk5V,IT y]C}L49(`X*DiO~# |,BP>}D}L5VD C# 4D~{* gwenProc.cs,"R_PTBq=: Z 10 B &CLr`LM}L'V 255 using System; using System.IO; using System.Data; using IBM.Data.DB2; using IBM.Data.DB2Types; namespace bizLogic { class empOps { ... // C# procedures ... } } ZD~%?8>KD~|,DZ]#g{D~PDNN}L|, SQL,G4Xk|, IBM.Data.DB2#g{D~PDNN}L|, XML `MDN}rd?,G4Xk|, IBM.Data.DB2Types#KD~PP;v{FUdywM;v|,}LD empOps `#Gq 9C{FUdGI!D#g{9CK{FUd,G4{FUdXkvVZ CREATE PROCEDURE odD EXTERNAL SdPya)DiO~76{P# ;(*GB`D~D{F"{FUdT0|,x(}L5VD`{#b){FG\X *D,r*?v}LD CREATE PROCEDURE odD EXTERNAL SdXk8(K E",Tc DB2 }]b53ITR= CLR }LDiO~M`# >} 1:9C XML &\?~D C# N}y= GENERAL }L K>}T>BPwnZ]: v N}y= GENERAL }LD CREATE PROCEDURE od v 9C XML N}DN}y= GENERAL }LD C# zk K}LIC=vN},;v{} inNum M;v inXML#b)5;ek= xmlDataTable mP#;s9C XQuery 4lw XML 5#9C SQL 4lwm;v XML 5#+l w=D XML 58(x=vdvN}:outXML1 M outXML2#;a5XNNa{/# CREATE PROCEDURE xmlProc1 ( IN inNUM INTEGER, IN inXML XML as CLOB (1K), OUT inXML XML as CLOB (1K), OUT inXML XML as CLOB (1K) ) LANGUAGE CLR PARAMETER STYLE GENERAL DYNAMIC RESULT SETS 0 FENCED THREADSAFE DETERMINISTIC NO DBINFO MODIFIES SQL DATA PROGRAM TYPE SUB EXTERNAL NAME ’gwenProc.dll:bizLogic.empOps!xmlProc1’ ; //************************************************************************* // Stored Procedure: xmlProc1 // // Purpose: insert XML data into XML column // // Parameters: // // IN: inNum -- the sequence of XML data to be insert in xmldata table // inXML -- XML data to be inserted 256 pureXML 8O // OUT: outXML1 -- XML data returned - value retrieved using XQuery // outXML2 -- XML data returned - value retrieved using SQL //************************************************************************* public static void xmlProc1 ( int inNum, DB2Xml inXML, out DB2Xml outXML1, out DB2Xml outXML2 ) { // Create new command object from connection context DB2Parameter parm; DB2Command cmd; DB2DataReader reader = null; outXML1 = DB2Xml.Null; outXML2 = DB2Xml.Null; // Insert input XML parameter value into a table cmd = DB2Context.GetCommand(); cmd.CommandText = "INSERT INTO " + "xmlDataTable( num , xdata ) " + "VALUES( ?, ? )"; ; parm = cmd.Parameters.Add("@num", DB2Type.Integer ); parm.Direction = ParameterDirection.Input; cmd.Parameters["@num"].Value = inNum; parm = cmd.Parameters.Add("@data", DB2Type.Xml); parm.Direction = ParameterDirection.Input; cmd.Parameters["@data"].Value = inXML ; cmd.ExecuteNonQuery(); cmd.Close(); // Retrieve XML value using XQuery and assign value to an XML output parameter cmd = DB2Context.GetCommand(); cmd.CommandText = "XQUERY for $x " + "in db2-fn:xmlcolumn(\"xmlDataTable.xdata\")/doc "+ "where $x/make = \’Mazda\’ " + "return {$x/make}{$x/model}"; reader = cmd.ExecuteReader(); reader.CacheData= true; if (reader.Read()) { outXML1 = reader.GetDB2Xml(0); } else { outXML1 = DB2Xml.Null; } reader.Close(); cmd.Close(); // Retrieve XML value using SQL and assign value to an XML output parameter value cmd = DB2Context.GetCommand(); cmd.CommandText = "SELECT xdata " + "FROM xmlDataTable " + "WHERE num = ?"; parm = cmd.Parameters.Add("@num", DB2Type.Integer ); parm.Direction = ParameterDirection.Input; cmd.Parameters["@num"].Value = inNum; reader = cmd.ExecuteReader(); reader.CacheData= true; if (reader.Read()) { outXML2 = reader.GetDB2Xml(0); } else { outXML = DB2Xml.Null; } reader.Close(); Z 10 B &CLr`LM}L'V 257 cmd.Close(); return; } >}:C }LPD XML M XQuery 'V ;)zKbK}LDy!*6"C }LD5J"XQuery M XML,MIT*<4( C }L"+|Gk XML &\?~dO9C# TB>}5wKN}`M* XML D C }LT0gN|BMi/ XML }]# Hvu~ Z9CC C }L>}.0,zI\h*DATBEnwb: v 9C}LDEc BP>}9C;v{* xmlDataTable Dm,CmD(egBy>: CREATE TABLE xmlDataTable ( num INTEGER, xdata XML ) INSERT INTO xmlDataTable VALUES (1, XMLPARSE(DOCUMENT ’ car Pontiac Sunfire ’ PRESERVE WHITESPACE)), (2, XMLPARSE(DOCUMENT ’ car Mazda Miata ’ PRESERVE WHITESPACE)), (3, XMLPARSE(DOCUMENT ’ person Mary Vancouver Waterside ’ PRESERVE WHITESPACE)), (4, XMLPARSE(DOCUMENT ’ person Mark Edmonton Oak ’ PRESERVE WHITESPACE)), (5, XMLPARSE(DOCUMENT ’ animal dog ’ PRESERVE WHITESPACE)), (6, NULL), (7, XMLPARSE(DOCUMENT ’ car Ford Taurus ’ PRESERVE WHITESPACE)), (8, XMLPARSE(DOCUMENT ’ person Kim Toronto Elm ’ PRESERVE WHITESPACE)), (9, XMLPARSE(DOCUMENT ’ person Bob 258 pureXML 8O Toronto Oak ’ PRESERVE WHITESPACE)), (10, XMLPARSE(DOCUMENT ’ animal bird ’ PRESERVE WHITESPACE)) }L Z4(zT:D C }L1,I+BP>}w*N<: v :C b?zkD~; v :>} 1:9C XML &\?~D C N}y= SQL }L; C b?zkD~ C>}I=?ViI:}LD CREATE PROCEDURE odMb? C zk5V,IT y]C}L49(`X*DiO~# |,BP>}D}L5VD C 4D~{* gwenProc.SQC,"R_PTBq=: #include #include #include #include #include #include #include #include // C procedures ... ZD~%?8>KD~|,DZ]#6k= SQL }LPD XML 'V;h*nbD| ,D~# ;(*GBD~D{FT0k}L5V`T&D/}D{F#b){FG\X*D, r*?v}LD CREATE PROCEDURE odD EXTERNAL SdXk8(KE", Tc DB2 }]b\mwITR=k C }L`T&DbMkZc# >} 1:9C XML &\?~D C N}y= SQL }L K>}T>BPwnZ]: v N}y= SQL }LD CREATE PROCEDURE od v 9C XML N}DN}y= SQL }LD C zk K}L+SU=vdkN}#Z;vdkN}{* inNum,d`M* INTEGER#Z~ vdkN}{* inXML,d`M* XML#b)dkN}D5C4+;Pek= xmlDataTable mP#;s9C SQL od4lw XML 5#9C XQuery mo=4l wm;v XML 5#+lw=D XML 5Vp8(x=vdvN}:out1XML M out2XML#;a5XNNa{/# CREATE PROCEDURE xmlProc1 ( IN inNUM INTEGER, IN inXML XML as CLOB (1K), OUT inXML XML as CLOB (1K), OUT inXML XML as CLOB (1K) ) LANGUAGE C PARAMETER STYLE SQL DYNAMIC RESULT SETS 0 Z 10 B &CLr`LM}L'V 259 FENCED THREADSAFE DETERMINISTIC NO DBINFO MODIFIES SQL DATA PROGRAM TYPE SUB EXTERNAL NAME ’gwenProc!xmlProc1’ ; //************************************************************************* // Stored Procedure: xmlProc1 // // Purpose: insert XML data into XML column // // Parameters: // // IN: inNum -- the sequence of XML data to be insert in xmldata table // inXML -- XML data to be inserted // OUT: out1XML -- XML data returned - value retrieved using XQuery // out2XML -- XML data returned - value retrieved using SQL //************************************************************************* #ifdef __cplusplus extern "C" #endif SQL_API_RC SQL_API_FN testSecA1(sqlint32* inNum, SQLUDF_CLOB* inXML, SQLUDF_CLOB* out1XML, SQLUDF_CLOB* out2XML, SQLUDF_NULLIND *inNum_ind, SQLUDF_NULLIND *inXML_ind, SQLUDF_NULLIND *out1XML_ind, SQLUDF_NULLIND *out2XML_ind, SQLUDF_TRAIL_ARGS) { char *str; FILE *file; EXEC SQL INCLUDE SQLCA; EXEC SQL BEGIN DECLARE SECTION; sqlint32 hvNum1; SQL TYPE IS XML AS CLOB(200) hvXML1; SQL TYPE IS XML AS CLOB(200) hvXML2; SQL TYPE IS XML AS CLOB(200) hvXML3; EXEC SQL END DECLARE SECTION; /* Check null indicators for input parameters */ if ((*inNum_ind < 0) || (*inXML_ind < 0)) { strcpy(sqludf_sqlstate, "38100"); strcpy(sqludf_msgtext, "Received null input"); return 0; } /* Copy input parameters to host variables */ hvNum1 = *inNum; hvXML1.length = inXML->length; strncpy(hvXML1.data, inXML->data, inXML->length); /* Execute SQL statement */ EXEC SQL INSERT INTO xmlDataTable (num, xdata) VALUES (:hvNum1, :hvXML1); /* Execute SQL statement */ EXEC SQL SELECT xdata INTO :hvXML2 FROM xmlDataTable WHERE num = :hvNum1; sprintf(stmt5, "SELECT XMLQUERY(’for $x in $xmldata/doc 260 pureXML 8O return {$x/model}’ passing by ref xmlDataTable.xdata as \"xmldata\" returning sequence) FROM xmlDataTable WHERE num = ?"); EXEC SQL PREPARE selstmt5 FROM :stmt5 ; EXEC SQL DECLARE c5 CURSOR FOR selstmt5; EXEC SQL OPEN c5 using :hvNum1; EXEC SQL FETCH c5 INTO :hvXML3; exit: /* Set output return code */ *outReturnCode = sqlca.sqlcode; *outReturnCode_ind = 0; return 0; } }LDT\ }LDT\a\=wVrXD0l,b)rX|(:}LD`MM5V"}LP|, D SQL od}?"}LP SQL D4SLH"}LDN}}?"}L5VPD_-D 'JT0}LPDms&m=(HH# r*C'(#!q(}5V}L4a_&CLrDT\,yT,qCnQ}LT\G \X*D# BmE(Ka0l}LT\D;);crX,"TgN(}Dd?vrX4a_}L T\a)K(i#PXa0lX(}L`MDT\rXD|`j8E",kNDXZ X(}L`MDT\Mw{wb# m 33. T\"bBnMXZ}LT\D(i T\"bBn T\(i }L`M:}L"/}M=( v }L"/}M=(DC>;,,}CD;C2;,#I Z|GZ&\OfZnl,rK\Q1SHO|GDT \# v ;c45,P1rIT+}LD4*/}(HdGZ} L5Xj?5"Rvi/}]DivB),byTT\ T"PyDF#+G,(#G(}r/5V SQL _-y h*D SQL 4DFT\D# v C'(eDu'f# v \;jIBPNqD_-GnJOZ}Lb0D_-: Xk4P`N}]bi/,&mPda{,nU5XQ 9CD;?V}]#4S}]ZrMh*i/`X}] DsM|BMGbV_-D;)>}#s?D SQL &m GZ}]b~qwOjID,"R;+O!D}]a{ /5XxwC_# 262 pureXML 8O m 33. T\"bBnMXZ}LT\D(i (x) T\"bBn T\(i }LPD SQL odD4ST v +G#4SDi/|,Z}LPG\PbeD,byM ITdV{C}]b~qwDZfMT\EF# v ;X#D SQL od}Z4S# }LPD2, SQL r/, SQL D4Piv v (#,2, SQL H/, SQL D4PT\|C#Z}L P,1z9C2, SQL r/, SQL 1;Pd{np# }LDN}}? v +}LDN}}?uY=nMLHITa_}LDT \,r*byvI9CZ}LM}LwCLr.d+] D:ex}?uY=nMLH# }LN}D}]`M v IT(}Z}L(eP9C VARCHAR N}(x;G CHAR N})4a_}LDT\#(}9C VARCHAR }]`Mx;G CHAR }]`M,IT@9 DB2 }]b 53Z+]N}.0*N}ndUq,"RuLZxg P+dCN}yh*D1d# }g,g{M'z&CLr+V{.“A SHORT STRING” +]x;vZ{9C CHAR(200) N}D}L,G4 DB2 }]b53Xk*N}nd 186 vUq,"T NULL U 9CV{.,;s+I 200 vV{iID{vV{.M NULL U9{(}xg"MA}L# `HOxT,g{+,;V{. ″A SHORT STRING″ + ]xZ{9C VARCHAR(200) N}D}L,G4 DB2 } ]b53;a(}xg4+]Ib 14 vV{iIDV{ .M NULL U9{# }LN}Du: v ;c45,9C NOT FENCED Sd44(}LEZ9C FENCED Sd44(}L#0;V=(a9}Lk DB2 }]b\mwZ,;xLPKP,xs;V=(a9} LZ}fDX7Ud.bD;vX(D DB2 }]bxL PKP# v d;zI\O*KP;\@$D}Laa_}LDT \,+G;\@$D}LPDC'zkI\aPbr^ bXY5}]brF5}]bXFa9#rK,v1z h*q!nQT\"R7E}Lc;2+DivB,E &9C NOT FENCED Sd#PX@@M5M+ C/C++ }L"a* NOT FENCED }LDgUDE",kND} L2+T#g{}LZ}]b\mwDxLPKP1; Gc;2+,G4&9C FENCED Sd44(}L#* K^F4(MKPI\;2+Dzk,DB2 }]b53* sC'_PXbX( CREATE_NOT_FENCED_ROUTINE E\4( NOT FENCED }L# v g{zZKP NOT FENCED }L1"zl#U9,G4 g{}L;"a* NO SQL,}]b\mwMa"TxP `&DV4#+G,TZ4(e* NO SQL D}L,} ]b\mw+'\# v g{ NOT FENCED }L9C GRAPHIC r DBCLOB } ],G4Xk9C WCHARTYPE NOCONVERT !n4 $`kb)}L# 264 pureXML 8O m 33. T\"bBnMXZ}LT\D(i (x) T\"bBn T\(i }LDKP1==(FENCED r NOT FENCED Sdf6) FENCED THREADSAFE SdDC> v 9C FENCED THREADSAFE Sd4(D}Lkd{} LKPZ,;xLP#|_eX5,G Java }La2m; vxL,x Java }La2mm;vxL(M9Cd{oT `4D}LGVkD)#(}bVVt,IT9 Java }L ;a\=9Cd{oT`4DI\azz\`msD} LD0l#mb,Java }LDxL|, JVM,b+\_,"Rd{}L`M;a9CC JVM#`Nw C FENCED THREADSAFE }L1a2mJ4,rK, bV}LH FENCED NOT THREADSAFE }LD53* zY,r*?v FENCED NOT THREADSAFE }L* db2fmp (pid)(dP pid G9C\@$==xLDzmLrDxLj6)r db2fmp (UP)# Z 10 B &CLr`LM}L'V 265 m 33. T\"bBnMXZ}LT\D(i (x) T\"bBn T\(i }LPD SQL CJ6p:NO SQL"CONTAINS SQL"READS SQL DATA M MODIFIES SQL DATA v 9COM6pD SQL CJSd4(D}L,+H9CO _6pD SQL CJSd4(D}LD4PT\|_#r K,&C9Cn\^F6pD SQL CJSd4yw} L#}g,g{}L;A! SQL }],G4;*9C MODIFIES SQL DATA Sd4(|,xG9C\=|` ^FD READS SQL DATA Sd44(|# }Lv([(DETERMINISTIC r NOT DETERMINISTIC Sdf6) v 9C DETERMINISTIC r NOT DETERMINISTIC Sd 4yw}LT}LT\;P0l# }L4PDb?YwD}?M4ST(EXTERNAL ACTION Sdf6) v y]b?}L4PDb?YwD}?M4ST,I\a 0l}LDT\#0l}LT\DrX|(:xgw ?"TD~DA4CJ("4Pb?Ywyh*D1d T0kb?YwzkPDRprP*`XDgU# 1dkN}*U1D}LwC(CALLED ON NULL INPUT Sdf6) v g{SU=UdkN}51&CLr pureXML y> pureXML &\Jm+a945w XML 'V;b)y>sBV*TB8`: \my> b)y>5wKBP&\: v XML #='V:XML D5D#="aMi$ 266 pureXML 8O v “* XML }]("w}”'V:T XML 5D;,Zc`M("w} v XML D5CLr'V:Import"export"runstats"db2look M db2batch T XML }]`MD'V &CLr*"y> b)y>5wKBP&\: v XML ek"|BM>}:+ XML 5ek XML `MP,|BM>}VP 5 v XML bv"i$MrP/'V:~=MT=bvf]}]`M"i$ XML D5T0rP/ XML }] v lO9C SQL M XQuery:9C SQL/XML /}(}g,XMLTABLE M XMLQUERY)M XMLEXISTS =J v SQL }LMb?}LPD XML }]`M'V:(}|, XML }]`MD N}4+ XML }]+]A SQL }LMb?}L v x"MD XML #=Vb'V:y]x"MD XML #=4Vb XML D5 v XML " b)y>5wgN9CT XQuery M SQL/XML `4D AXIS"FLWOR mo =Mi/# IZTB;CR=b)y>: v Z Windows O:%DB2PATH%\sqllib\samples\xml(dP %DB2PATH% G;vd?,| 7( DB2 }]b~qwD20;C) v Z UNIX O:$HOME/sqllib/samples/xml(dP $HOME G5}yP_Dw?<) pureXML - \my> b)y>5wKTwV\m&\D pureXML 'V,|( XML #='V"5CLr' VM XML }]("w}'V# ICwV`LoTa)Kb)y>,"RITZTB;CDX(ZoTDS? 4oTi`Dy> y>Lr{ Lrhv C xmlrunstats.sqc T|, XML `MPDm4P RUNSTATS# lobstoxml.sqc 9C IMPORT M EXPORT |n+ LOB }]Fk XML P impexpxml.sqc 4oTi`Dy> y>Lr{ Lrhv C xmlindex.sqc 4(;vw}"Z XQuery i/P9C |# xmlconst.sqc 9C XML #=4(;v_P UNIQUE M VARCHAR $H (x) 4oTi`Dy> y>Lr{ Lrhv CLI xmlindex.c 4(;vw}"Z XQuery i/P9C |# xmlconst.c 9C XML #=4(;v_P UNIQUE M VARCHAR $H b)y>5wKngBP&CLr*"&\D XML 'V:ek"|BM>}"XML b v"i$"rP/"lO9C SQL/XML"SQL Mb?f"}LPD XML }]`M' V"XML VbT0 SQL/XML ","RITZTB;CDX(ZoTDS? 4oTi`Dy> y>Lr{ Lrhv CLI xmlinsert.c + XML D5ek= XML }] `MDPP# xmlupdel.c |BM>}mPD XML D5# xmlread.c A!f"ZmPD XML }]# reltoxmldoc.c 9CwV SQL/XML " (x) 4oTi`Dy> y>Lr{ Lrhv simple_xmlproc_client.c *wC simple_xmlproc.c PD}L DM'zLr# simple_xmlproc_create.db2 *"a simple_xmlproc.c PDf" }LD CLP E># simple_xmlproc_drop.db2 *>} simple_xmlproc.c PDf" }LD CLP E># C xmlinsert.sqc + XML D5ek= XML }] `MDPP# xmludfs.sqc 9Cj?/}"P4/}"T SQL *weD UDF Mm UDF 1,+ XML }]`Mw*dk N}4+]"yw XML }]` MV?d?"5X5# xmludfs.c 9Cj?/}"P4/}"T SQL *weD UDF Mm UDF 1,+ XML }]`Mw*dk N}4+]"yw XML }]` MV?d?"5X5# xmlupdel.sqc |BM>}mPD XML D5# xmlread.sqc A!f"ZmPD XML }]# reltoxmltype.sqc 9CwV SQL/XML " simple_xmlproc_create.db2 *"a simple_xmlproc.sqc PDf "}LD CLP E># simple_xmlproc_drop.db2 *>} simple_xmlproc.sqc PDf "}LD CLP E># xmltrig.sqc 9C%"w&m&\4?FT/i $kV XML D5# xmlintegrate.sqc 9C XMLROW M XMLGROUP /}+X5}]3dA XML#5 w XMLQuery 1!+]zFM XMLTABLE D1!Pf6# 270 pureXML 8O m 37. pureXML - &CLr*"y> (x) 4oTi`Dy> y>Lr{ Lrhv xmlcheckconstraint.sqc 9C IS VALIDATED M IS NOT VALIDATED =J4(Z XML P O _ P l i < x D m , " 9 C ACCORDING TO XMLSCHEMA Sd8(;Vr`V#=# xmlxslt.sqc 9C XSLTRANSFORM /}+} ] b P D XML D 5 * ; * HTML"?D>rd{9Cy=m D XML q=# CLP xmlinsert.db2 + XML D5ek= XML }] `MDPP# xrpart.db2 Z6'VxmP9C XML "R 'VV?w}M+Vw}# xmlpartition.db2 ZVx}]b73"MDC M6' VxmP9C XML# xmlmdc.db2 +}]S MDC mFAG MDC m,9Ciw}M+Vw},T0 |lekM>}# xmludfs.db2 9Cj?/}"P4/}"T SQL *weD UDF Mm UDF 1,+ XML }]`Mw*dk N}4+]"5X5# xmldbafn.db2 9CZ* DBA /}47( XML D5D@FZ*$H# xmlolic.db2 XBi/Tm(eDw}T0gN XBi/6'VxmDGVxw }# xmlindgtt.db2 9C XML }]`MDQyw+ VY1m# xmlupdel.db2 |BM>}mPD XML D5# reltoxmldoc.db2 9CwV SQL/XML " (x) 4oTi`Dy> y>Lr{ Lrhv xmltotable.db2 9C SQL/XML /}(}g, XMLTABLE M XMLQUERY)M XMLEXISTS =J+ XML D5P D}]ek=X5mP# xmltrig.db2 9C%"w&m&\4?FT/i $kV XML D5# xmlintegrate.db2 9C XMLROW M XMLGROUP /}+X5}]3dA XML#5 w XMLQuery 1!+]zFM XMLTABLE D1!Pf6# xmlcheckconstraint.db2 9C IS VALIDATED M IS NOT VALIDATED =J4(Z XML P O _ P l i < x D m , " 9 C ACCORDING TO XMLSCHEMA Sd8(;Vr`V#=# xmlxslt.db2 9C XSLTRANSFORM /}+} ] b P D XML D 5 * ; * HTML"?D>rd{9Cy=m D XML q=# JDBC XmlInsert.java + XML D5ek= XML }] `MDPP# XmlMdc.java +}]S MDC mFAG MDC m,9Ciw}M+Vw},T0 |lekM>}# XmlUdfs.java 9Cj?/}"P4/}"T SQL *weD UDF Mm UDF 1,+ XML }]`Mw*dk N}4+]"5X5# XmlUpDel.java |BM>}mPD XML D5# XmlRead.java A!f"ZmPD XML }]# RelToXmlDoc.java 9C SQL/XML " (x) 4oTi`Dy> y>Lr{ Lrhv Simple_XmlProc_Client.java *wC Simple_XmlProc.java PD} LDM'zLr# Simple_XmlProc_Create.db2 *"a Simple_XmlProc.java PDf "}LD CLP E># Simple_XmlProc_Drop.db2 *>} Simple_XmlProc.java PDf "}LD CLP E># XmlToTable.java 9C SQL/XML /}(}g, XMLTABLE M XMLQUERY)M XMLEXISTS =J+ XML D5P D}]ek=X5mP# XmlTrig.java 9C%"w&m&\4?FT/i $kV XML D5# XmlCheckConstraint.java 9C IS VALIDATED M IS NOT VALIDATED =J4(Z XML P O _ P l i < x D m , " 9 C ACCORDING TO XMLSCHEMA Sd8(;Vr`V#=# SQLJ XmlInsert.sqlj + XML D5ek= XML }] `MDPP# XmlUpDel.sqlj |BM>}mPD XML D5# XmlRead.sqlj A!f"ZmPD XML }]# RelToXmlDoc.sqlj 9C SQL/XML "rd{9Cy=m D XML q=# PHP XmlFlwor_DB2.php 9C XQuery FLWOR mo=# XmlIndex_DB2.php 4(;vw}"Z XQuery P9C Kw}# XmlInsert_DB2.php + XML D5ek= XML }]` MDPP# XmlRead_DB2.php A!f"ZmPD XML }]# Z 10 B &CLr`LM}L'V 273 m 37. pureXML - &CLr*"y> (x) 4oTi`Dy> y>Lr{ Lrhv XmlRelToXmlDOC_DB2.php 9C SQL/XML "}mPD XML D5# XmlToTable_DB2.php 9C SQL/XML + XML D5PD }]ek=X5mP# XmlXPath_DB2.php KPr%D XPath i/# XmlXQuery_DB2.php 4P6WD XQuery FLWOR mo =# 274 pureXML 8O Z 11 B XML T\ BPwb|(9C pureXML &\?~1ITq-DT\w{"bBn# `XE": DB2 PCZa_ pureXML T\D 15 vnQv( pureXML &\?~M}]i/=8 + pureXML &\?~k}]bVx73"mVxT0`,/:.`D}]i/=8d O9C,ITTxa_i/T\,"5M}],$Yw(}g,Xi"ekM>}) D*z# CREATE TABLE odDBP}vSd|,CZ8>&gNi/}]Dc(: v DISTRIBUTE BY,CZ+}]=yV} XQuery d;mo=ZVx}]b73P\'V,"RIZ9Ci!"d;M0k (ETL)YwD!0P9C# }g,S,S=v4m(ORDERS M PRODUCT)Da{Pi! XML }],+dd ;*Z{q="w* XML }]ek=?jm SALES P1,IT9C XQuery d;m o=#+G,d;mo=Zmo=dkv}C%vmx;GtI4mD,S14PC nC# + XQuery d;mo=k`vmdO9C1,g{`TZ4mDs!xT,,Sa{\ !,G4`4X(D%vod(ZdP+d;mo=1S&CZ,Sa{)(#I! CIS\DT\#+G,g{,SzzDP}k4mPDP}n;`uA|`,G4 &}5w+9C,SM XQuery d;YwD%vodVnI=vodD(C}P9CDmM}] C>}9C4m ORDERS M PRODUCTS"?jm SALES T0Qyw+VY1m TEMPSALES#>}S ORDER mlw}],+C}]k4T PRODUCTS mD([E "`,S,;sq=/yzzD}],"+q=/sD}]ek= SALES mP# ORDERS m|,?U)%0dj6(OID)M XML P(ORDERDETAIL)PD)%E "#?v XML D5|,M'j6(CID)MQ):z7#?vQ):z7DE"|, z7j6"}?MMu*s#TB CREATE od+4(>} ORDERS m: CREATE TABLE ORDERS(OID BIGINT, ORDERDETAIL XML)DISTRIBUTE BY HASH (OID); TB INSERT od+y>)%ek= ORDERS mP: INSERT into ORDERS values (5003, ’ 1001 234410 Overnight 5373 Ground ’); PRODUCTS m|,z7E""z7j6(PID)"z7[q(PRICE)T0 XML P (PRODDETAIL)PPXz7Dj8E"#TB CREATE od+4(>} PROD- UCTS m: 276 pureXML 8O CREATE TABLE PRODUCTS(PID BIGINT, PRICE FLOAT, PRODDETAIL XML); TB INSERT od+z7}]ek= PRODUCTS mP: INSERT into PRODUCTS values(2344, 4.99, ’ 10 D-Cell batteries D Cell battery, 10-pack ’) INSERT into PRODUCTS values(537, 8.99, ’ Ice Scraper, small Basic ice scraper, 4 inches wide ’); SALES m|,)%j6(OID)"M'j6(CID)"z7j6E"(PID)")%\p n ( ITEMTOTAL) T 0 XML P P f"D P X ? v ) %Dj8E " (SALEDETAIL)#SALES mD?P|,vpQ):z7D`XE"#SALES mV< Z)%j6(OID)PO#TB CREATE od+4(>} SALES m: CREATE TABLE SALES(OID BIGINT, CID BIGINT, PID BIGINT, ITEMTOTAL FLOAT, SALESDETAIL XML) DISTRIBUTE BY HASH (OID); %vodPDm,SM XQuery d;mo= TB INSERT od,S ORDER M PRODUCT }],+d;mo=&CZzzD XML D5,;s+|BDD5ek= SALES mP: INSERT into SALES select T.OID, T.CID, T.PID, T.ITEMTOTAL, XMLQUERY(’ copy $new := $temp modify (do delete ($new/info/cid, $new/info/product/pid, $new/info/product/qty), do insert {fn:current-date()} as first into $new/info) return $new’ passing T.SALESDETAIL as "temp") from( SELECT O.OID, OX.CID, OX.PID, P.PRICE * OX.QTY, OX.SALESDETAIL FROM PRODUCTS P, ORDERS O, XMLTABLE(’for $i in $details/order/product return document{ {$details/order/cid} {$i} }’ passing O.ORDERDETAIL as "details" columns CID bigint path ’./info/cid’, PID bigint path ’./info/product/pid’, QTY int path ’./info/product/qty’, SALESDETAIL xml path ’.’) as OX WHERE P.PID = OX.PID) as T(OID, CID, PID, ITEMTOTAL, SALESDETAIL); B;?V5wgNC=v@"Dod4PZH0DodP4PDm,SM XQuery d ;# @"odPDm,SM XQuery d;mo= g{:%vodPDm,SM XQuery d;mo=;PodZ~?VPD,Sa{k ORDER M PRODUCT mDs!`H`nu6,G4+CodVn*=vodITa_ Z 11 B XML T\ 277 T\#+%vodVn*=vod1,Z;voda+,S ORDER k PRODUCT m Da{ekY1mP#Z~vod+d;&CZY1mPD XML D5,;s+|BD D5ek= SALES mP# Y1mk SALE m`F,CZf"Pdi/a{#Qyw+VY1m TEMPSALES C Z&m?U)%#*KC DB2 E/w}7E/CZ|BY1mM SALES mDi/, Y1m TEMPSALES M?jm SALES Xk_P`,DV<|"tZ,;Vxi#T B DECLARE od+4(Y1m TEMPSALES: DECLARE GLOBAL TEMPORARY TABLE SESSION.TEMPSALES LIKE SALES DISTRIBUTE BY HASH (OID); TB SELECT od|, PRODUCTS k ORDERS m.dD,S#Cod9C PROD- UCTS M ORDERS mPDE"4Fc ITEMTOTAL PD5,"9lek= TEMPSALES mPD XML D5#C,SkZ 277 3D:%vodPDm,SM XQuery d;mo=;P INSERT odPD,S`,# INSERT INTO SESSION.TEMPSALES SELECT O.OID, OX.CID, OX.PID, P.PRICE * OX.QTY, OX.SALESDETAIL FROM PRODUCTS P, ORDERS O, XMLTABLE(’for $i in $details/order/product return document{ {$details/order/cid} {$i} }’ passing O.ORDERDETAIL as "details" columns CID bigint path ’./info/cid’, PID bigint path ’./info/product/pid’, QTY int path ’./info/product/qty’, SALESDETAIL xml path ’.’) as OX WHERE P.PID = OX.PID; INSERT od9CDO;v SELECT od4|, XQuery d;mo=# Y1m|, SALES myhDX5E"#ZY1mZD XML D5P,h*}%z7E ""Rh*mS)%UZ# TB INSERT odSY1mP!q?Uz[E""+CE"ek=m SALES P#C INSERT od|, SELECT od,s_9CZ 277 3D:%vodPDm,SM XQuery d;mo=;P INSERT odPyCD XQuery d;mo=#Z+?v XML D5e k= SALE mP.0,Cmo=aSY1m^DC XML D5#r* TEMPSALES M SALES mZ,;VxiP,"R2m;v+2V<|,yTI"P4Pek# INSERT into SALES select T.OID, T.CID, T.PID, T.ITEMTOTAL, XMLQUERY(’ copy $new := $temp modify (do delete ($new/info/cid, $new/info/product/pid, $new/info/product/qty), do insert {fn:current-date()} as first into $new/info) return $new’ passing T.SALESDETAIL as "temp") from SESSION.TEMPSALES T; +QywY1mk XML }]dO9C 5Vh*4(GVCmDbv=81,Qyw+VY1mI\\PC#}g,&CL rI4(QywY1m4&mPda{#&CLrDa0ax1,+>}Y1m# 278 pureXML 8O Qyw+VY1mvZyw|Da0ZdfZ#Cm;\kd{a02m#a0ax 1,+>}Y1mDPT0hv#QywY1m;P?} TB>}Y(xP+>01E"Dm|, XML }]#01}]`FZTB01E": Laura Brown Finance TB CREATE od4(xP XML PD01m# CREATE TABLE COMPANYINFO (ID INT, DOC XML) TB=vod4(Ik01mdO9CD+VY1m#=vody4(Y1mDP{ Mhvk COMPANYINFO mDP{Mhv`,#Z;vod9CP(e4(Y1m# Z~vod9C LIKE Sd4(Y1m#CmwPD{FMhvk8(mwPD{FM hv`,#ON COMMIT DELETE ROWS Sd8(,g{4P COMMIT Yw1;P WITH HOLD NjTCm&Zr*4,,G4a>}CmDyPP# DECLARE GLOBAL TEMPORARY TABLE INSTMPTB (ID INT, DOC XML) ON COMMIT DELETE ROWS in USR_TBSP DECLARE GLOBAL TEMPORARY TABLE INSTMPTB LIKE COMPANYINFO ON COMMIT DELETE ROWS in USR_TBSP TB DECLARE od4(dy>mPf"K XML D5DY1m#g{ XML D5! Z8(D1Sek$H,G4|+f"Zy>mP# DECLARE GLOBAL TEMPORARY TABLE TEMPTB (ID INT, DOC XML INLINE LENGTH 3000) ON COMMIT PRESERVE ROWS NOT LOGGED g{*+s?}]ek=+VY1mP"Tb)}]4Pi/,G4I4(yZ XML }]Dw}TDxT\#}g,TB CREATE INDEX od4(=vyZ XML }] Dw}#Z;vw}yZ XML D5PD01j6#Z~vw}yZ01DUO# CREATE INDEX SESSION.TEMP_IDX ON SESSION.INSTMPTB (DOC) GENERATE KEY USING XMLPATTERN ’/company/emp/@id’ AS SQL INTEGER CREATE UNIQUE INDEX SESSION.TEMP_IDX2 ON SESSION.INSTMPTB (DOC) GENERATE KEY USING XMLPATTERN ’/company/name/last’ AS SQL VARCHAR(100) IZVx}]b73P4(Qyw+VY1mT{C}]bVx#TB DECLARE od (}+ DOCID CwV<|44(Y1m#+ XML }]mSAY1m.s,T XML }]Di/Md{YwI{CVx}]b73# Z 11 B XML T\ 279 DECLARE GLOBAL TEMPORARY TABLE INSTMPTB (ID INT, DOC XML) ON COMMIT DELETE ROWS IN USR_TBSP DISTRIBUTE BY HASH (ID) TB XQuery mo=9C+VY1mM COMPANYINFO m#Y1m|, COMPANYINFO mPD;?VD5#XQuery mo=5XY1mPpZ?E01D COMANYINFO mD01E"# XQUERY for $i in db2-fn:xmlcolumn("SESSION.INSTMPTB.DOC")/company/emp for $j in db2-fn:xmlcolumn("COMPANYINFO.DOC ")[/company/emp/@id = $i/@id ] where $i/dept = "Finance" return $j ; TB INSERT od+Y1mPD}]ek= COMPANYINFO mP# INSERT INTO COMPANYINFO FROM (SELECT ID, DOC FROM SESSION.INSTMPTB) 9C5w 9CQyw+VY1m1,TBwnJC: v QywY1m'V}]P9u#g{}]b\mw7(T\Pya},G4a9u mP}],b)}]|(T1Sek==f"Zy>mTsPD XML D5#+G, ;'VTQywY1mD XML f"TsxP}]9u# v ZVx}]b73P,9C DISTRIBUTE BY Sd44(xPVx|DQywY1 m#g{9C LIKE Sd4(QywY1m"R4m_PVx|,G4CY1m;P Vx|# v zTQywY1m4(Dw}'Vw}9u,b)QywY1m|(C'4(Dy Z XML }]Dw}# v C'4(DyZ XML }]Dw}k*GY1m4(Dw}fZ`,^F#}g,Z Vx}]b73P,;'V(;DyZ XML }]D XML w}# +E/DVv"!q3v XML w}CJ4CJm,= (G9C ACCESS CJks*X"+tT TYPE hC* XMLINDEX#}g,E /wI9C XML w}CJ,g XML w}(h"XANDOR rxPAY;v XML w}Dw}“k”(AND)Kc# – 8(9CyPJCDX5w}MyZ XML }]Dw}4CJ8(mx;,=(G9C ACCESS CJks*X,"+tT TYPE hC* XMLINDEX, T0+tT ALLINDEXES hC* TRUE# – 8(9C INAND F.PyPJCDX5w}MyZ XML }]Dw}4CJ8 (mx;,=(G9C IXAND CJks*X,"+tT TYPE hC* XMLINDEX,T0+tT ALLINDEXES hC* TRUE# 9C XML }]DE/} >}E/E*D~|,#fks"f!=(M,S3r SELECT * FROM security WHERE XMLEXISTS(’$SDOC/Security/SecurityInfo /StockInfo[Industry= "OfficeSupplies"]’) 9CyZ XML }]DX(w}D# SELECT * FROM security WHERE XMLEXISTS(’$SDOC/Security/SecurityInfo /StockInfo[Industry= "OfficeSupplies"]’) Z 11 B XML T\ 281 +yZ XML }]Dw}k XANDOR CJdO9CD SELECT * FROM security WHERE trans_date = CURRENT DATE AND XMLEXISTS(’$SDOC/Security/SecurityInfo /StockInfo[Industry= "Software"]’) AND XMLEXISTS(’$SDOC/Security/Symbol[.="IBM"]’) +yZ XML }]D`v8(w}k IXAND dO9CD3r+b=vw}w* IXAND F.D'y# SELECT * FROM security WHERE trans_date = CURRENT DATE AND XMLEXISTS(’$SDOC/Security/SecurityInfo /StockInfo[Industry= "Software"]’) AND XMLEXISTS(’$SDOC/Security/Symbol[.="IBM"]’) +yPyZ XML }]Dw}k IXAND dO9CD SELECT * FROM security WHERE trans_date = CURRENT DATE 282 pureXML 8O AND XMLEXISTS(’$SDOC/Security/SecurityInfo /StockInfo[Industry= "Software"]’) AND XMLEXISTS(’$SDOC/Security/Symbol[.="IBM"]’) +yZ XML }]DX(0D==!qCZ IXAND F.Dd{w}#g{X5w} ZP TRANS_DATE OIC,"RyZ XML }]Dw}Z76 SYMBOL OIC, "RE/wO*P{,G4b=vw}PD;vr+?+w* IXAND F.D=S'y vV# SELECT * FROM security WHERE trans_date = CURRENT DATE AND XMLEXISTS(’$SDOC/Security/SecurityInfo /StockInfo[Industry= "Software"]’) AND XMLEXISTS(’$SDOC/Security/Symbol[.="IBM"]’) 9C3) XML w}CJDDVv49C XISCAN"IXAND"XANDOR r IXOR F.# SELECT * FROM security WHERE XMLEXISTS(’$SDOC/Security/SecurityInfo /StockInfo[Industry= "OfficeSupplies"]’) 9CyPyZ XML }]DJCw}CJDDVvZ=vf!=8.dxP!q# SELECT * FROM security WHERE XMLEXISTS(’$SDOC/Security/SecurityInfo /StockInfo[Industry= "Software"]’) AND XMLEXISTS(’$SDOC/Security/Symbol[.="IBM"]’) 8(9CX(w}xPyZ XML }]Dw}DCJDDVv4!qBPdP;vf!=8: 1. 9C SEC_INDUSTRY w}D XISCAN F.# 2. +x(w}w*dZ;v'yD IXAND F.#E/wI\ay]yZI>DVv Z IXAND F.P9C|`w}#ZK>}P,g{X5w}ZP TRANS_DATE OIC,"RE/wO*P{,G4Cw}+w* IXAND F.D=S'yvV# 3. xPx(w}MyZ XML }]Dd{JCw}D XANDOR F.# SELECT * FROM security WHERE trans_date = CURRENT DATE AND XMLEXISTS(’$SDOC/Security/SecurityInfo /StockInfo[Industry= "Software"]’) AND XMLEXISTS(’$SDOC/Security/Symbol[.="IBM"]’) TBE/DVv9CBPdP;vf!=8: v + IXAND k SEC_INDUSTRY M SEC_SYMBOL w}(48(3r)dO9C# v + XANDOR F.kyPJC XML w}dO9C# XF,S3rM8(yZ XML }]Dw}CJD SELECT ordqty, orddate, ordid, security, lasttrade FROM order, security, custacc, XMLTABLE(’$ODOC/FIXML/Order’ COLUMNS ordid VARCHAR(10) PATH ’@ID’, orddate date PATH ’@TrdDt’, ordqty float PATH ’OrdQty/@Qty’) AS T1, XMLTABLE(’ $SDOC/Security’ COLUMNS security varchar(50) PATH ’Name’, lasttrade float PATH ’Price/LastTrade’) AS T2 WHERE XMLEXISTS(’ $SDOC/Security[Symbol/fn:string(.) = $ODOC/FIXML/Order/Instrmt/@Sym/fn:string(.)]’) and XMLEXISTS( ’$ODOC/FIXML/Order[@Acct/fn:string(.) = $CADOC/Customer/Accounts/Account/@id/fn:string(.)]’) and XMLEXISTS(’$CADOC/Customer[@id = 1011]’) ORDER BY ordqty desc XQuery mo=DDbfE"#C xquery for $sinfo1 in db2-fn:xmlcolumn("SECURITY1.SDOC")/Security/SecurityInfo /StockInfo[Industry="Software"] return $sinfo1 TBE/E*D~|, XQuery mo=,Cmo=5X-*m~MgSh8D+>Db fE"# C Z 11 B XML T\ 285 {$sinfo1} ]]> CDATA ?VT *7,"Z STMTKEY *XP|( odX|V,-rGCodX|V|,Xb XML V{ < M >#E*D~bvwvT CDATA ?VPD XML jG,+E/wT+9C{vodX|V49odE*D~k &CLrPDT&od`%d# CZ pureXML }]f"T\D DMS mUdDW!n TZT\tPD&CLr,XpGf0s? INSERT n/D&CLr,?R(iz9C }]b\mUd(DMS)DmUd# g{9C pureXML }]f"1"Vi/T\B5"R}Z9C53\mUd(SMS), G4&CmIz(F*Z?`k}]),2ITSb?4Iz(F *b?`k}])# C4Z&CLrk XML P.d;; XML }]D&CLr}]`M7(K`kDIz ==# v +V{rsxD> DVZ3r#DB2 }]b\mwv6p XML }]D BOM#TZf"ZG XML PPD XML }]45,}]b\mw+ BOM 5S*kNNd{V{ r~xF5`,# XML yw XML D5*7D&m8n#Kywa)PXd` XML Z]DX(j8E"# `kyw XML ywDI!?V,Kyw8(D5PV{D`k# DB2 }]b\mw9CTB}L47(`k: 1. g{}]|, Unicode BOM,G4`kI BOM 7(#BmP>K BOM `MT 0zzD}]`k: m 38. VZ3rjGT0zzDD5`k BOM `M BOM 5 `k UTF-8 X’EFBBBF’ UTF-8 UTF-16 s2}( X’FEFF’ UTF-16 UTF-16 !2}( X’FFFE’ UTF-16 © Copyright IBM Corp. 2006, 2013 287 m 38. VZ3rjGT0zzDD5`k (x) BOM `M BOM 5 `k UTF-32 s2}( X’0000FEFF’ UTF-32 UTF-32 !2}( X’FFFE0000’ UTF-32 2. g{}]|, XML yw,G4`k!vZGqP`kyw: v g{P`kyw,G4`kG encoding tT5#}g,TZxPTB XML yw D XML }]45,`kG EUC-JP: v g{P`kywM BOM,G4`kywXkk BOM PD`k%d#qr,+" zms# v g{H;P`kyw2;P BOM,G4}]b\mwy] XML ywD`k47 (`k: – g{ XML yw9C%VZ ASCII V{,G4D5`kG UTF-8# – g{ XML yw9C+VZ ASCII V{,G4D5`kG UTF-16# 3. g{H;P XML yw2;P BOM,G4D5`kG UTF-8# f"r+] XML }]1D`k"bBn XML }]Xk}7xP`kE\f"Z DB2 mP#1SmPlw=}]"k DB2 f "}Lr_C'(eD/}dO9C1,r_kb? Java &CLrdO9C1,Xk 4}]V{1,Ma*'}]#Z*;=?j}] `M1,g{a# getDB2Xmlxxx ywPD`k getDB2XmlString ISO-10646-UCS-2 getDB2XmlBytes(String targetEncoding) targetEncoding 8(D`k getDB2XmlAsciiStream US-ASCII getDB2XmlCharacterStream ISO-10646-UCS-2 getDB2XmlBinaryStream(String targetEncoding) targetEncoding 8(D`k Z 12 B XML }]`k 289 TZ8(K INCLUDING XMLDECLARATION DT= XMLSERIALIZE /}45, }]b~qw+mS`k,"R JDBC }/Lr;a^DC`k#}]b~qwmS DT=`kG UTF-8 `k#y]&CLrlw51IC==D;,,}]D5J` kI\kT=DZ?`k;%d# v g{&CLr+dv}]"MA XML bvw,G4&C9C UTF-8"UCS-2 r UTF-16 `k4Z~xF&CLrd?PlwC}]# XML `kMrP/TZ}]*;D0l Z}]bk&CLr.d+]}]1,XML rP/D=(T0ZZ?rb?CZ8( XML }]`kD=(+0l XML }]D*;# `kiv:+Z?`kD XML }]dk=}]bP >}5wZ+ XML }]dk XML P1Z?`kT}]*;MXOD0l# (#,9C~xF&CLr}]`M\;nsLHXuY+}]dk}]bZdDz k3*;Jb# iv 1 `k4 5 }]`k UTF-8 Unicode dk}],xPr;x UTF-8 BOM r XML `kyw &CLr}]` M ~xF &CLrzk3 ;JC dkod>}: INSERT INTO T1 (XMLCOL) VALUES (?) INSERT INTO T1 (XMLCOL) VALUES (XMLPARSE(DOCUMENT CAST(? AS BLOB) PRESERVE WHITESPACE)) V{*;:;xPV{*;# *'}]:;a*'}]# XO:;aXO}]# iv 2 `k4 5 }]`k UTF-16 Unicode dk}],|, UTF-16 BOM r XML `kyw &CLr}]` M ~xF &CLrzk3 ;JC dkod>}: INSERT INTO T1 (XMLCOL) VALUES (?) INSERT INTO T1 (XMLCOL) VALUES (XMLPARSE(DOCUMENT CAST(? AS BLOB) PRESERVE WHITESPACE)) 290 pureXML 8O V{*;:DB2 }]b~qw4P XML bv1+Q}]S UTF-16 *;* UTF-8 T cf"Z XML PP# *'}]:;a*'}]# XO:;aXO}]# iv 3 `k4 5 }]`k ISO-8859-1 dk}],|, XML `kyw &CLr}]` M ~xF &CLrzk3 ;JC dkod>}: INSERT INTO T1 (XMLCOL) VALUES (?) INSERT INTO T1 (XMLCOL) VALUES (XMLPARSE(DOCUMENT CAST(? AS BLOB) PRESERVE WHITESPACE)) V{*;:DB2 }]b534P XML bv1+Q}]S CCSID 819 *;* UTF-8 Tcf"Z XML PP# *'}]:;a*'}]# XO:;aXO}]# iv 4 `k4 5 }]`k Shift_JIS dk}],|, XML `kyw &CLr}]` M ~xF &CLrzk3 ;JC dkod>}: INSERT INTO T1 (XMLCOL) VALUES (?) INSERT INTO T1 (XMLCOL) VALUES (XMLPARSE(DOCUMENT CAST(? AS BLOB) PRESERVE WHITESPACE)) V{*;:DB2 }]b534P XML bv1+Q}]S CCSID 943 *;* UTF-8 Tcf"Z XML PP# *'}]:;a*'}]# XO:;aXO}]# `kiv:+b?`kD XML }]dk=}]bP >}5wZ+ XML }]dk XML P1b?`kT}]*;MXOD0l# Z 12 B XML }]`k 291 (#,9CV{&CLr}]`M1,Z+}]dk}]bZd;fZzk3*;J b# IZ Java M .NET &CLrD&CLrzk3}: INSERT INTO T1 (XMLCOL) VALUES (?) INSERT INTO T1 (XMLCOL) VALUES (XMLPARSE(DOCUMENT CAST(? AS CLOB) PRESERVE WHITESPACE)) V{*;:;xPV{*;# *'}]:;a*'}]# XO:;aXO}]# iv 2 `k4 5 }]`k UTF-16 Unicode dk}],xPr;xJ1D`kywr BOM &CLr}]` M }: INSERT INTO T1 (XMLCOL) VALUES (?) INSERT INTO T1 (XMLCOL) VALUES (XMLPARSE(DOCUMENT CAST(? AS DBCLOB) PRESERVE WHITESPACE)) V{*;:DB2 }]b534P XML bv1+Q}]S UTF-16 *;* UTF-8 T cf"Z XML PP# *'}]:;a*'}]# XO:IZaxP)9,yTZS UTF-16 *;* UTF-8 ZdI\a"zXO# iv 3 `k4 5 }]`k ISO-8859-1 dk}],xPr;xJ1D`kyw &CLr}]` M V{ 292 pureXML 8O `k4 5 &CLrzk3 819 dkod>}: INSERT INTO T1 (XMLCOL) VALUES (?) INSERT INTO T1 (XMLCOL) VALUES (XMLPARSE(DOCUMENT CAST(? AS CLOB) PRESERVE WHITESPACE)) V{*;:DB2 }]b534P XML bv1+Q}]S CCSID 819 *;* UTF-8 Tcf"Z XML PP# *'}]:;a*'}]# XO:;aXO}]# iv 4 `k4 5 }]`k Shift_JIS dk}],xPr;xJ1D`kyw &CLr}]` M }: INSERT INTO T1 VALUES (?) INSERT INTO T1 VALUES (XMLPARSE(DOCUMENT CAST(? AS DBCLOB))) V{*;:DB2 }]b534P XML bv1+Q}]S CCSID 943 *;* UTF-8 Tcf"Z XML PP# *'}]:;a*'}]# XO:;aXO}]# `kiv:(}~=DrP/Yw4lw XML }] >}5w(}~=DrP/Ywlw XML }]1,?j`kM&CLrzk3T}] *;"XOMZ?`kD0l# IZ Java &CLrD&CLrzk3}: SELECT XMLCOL FROM T1 V{*;:;xPV{*;# *'}]:;a*'}]# XO:;aXO}]# rP/}]PDZ?`k:TZ} Java r .NET &CLrTbD&CLr45,}] 9CTB XML yww*0:: TZ Java &CLr,}G+}]*;* com.ibm.db2.jcc.DB2Xml `M"9C getDB2Xmlxxx =(lw}],qr;amS`kyw#mSDyw!vZ9CD getDB2Xmlxxx# TZ .NET &CLr,;amSr}%`kyw# iv 2 `k4 5 ?j}]`k UTF-16 Unicode ?j&CLr} ]`M }: SELECT XMLCOL FROM T1 V{*;:+}]S UTF-8 *;* UTF-16# *'}]:;a*'}]# XO:IZaxP)9,yTZS UTF-8 *;* UTF-16 ZdI\a"zXO# rP/}]PDZ?`k:TZ} Java r .NET &CLrTbD&CLr45,}] 9C UTF-16 VZ3rjG(BOM)MTB XML yww*0:: TZ Java &CLr,}G+}]*;* com.ibm.db2.jcc.DB2Xml `M"9C getDB2Xmlxxx =(lw}],qr;amS`kyw#mSDyw!vZ9CD getDB2Xmlxxx# TZ .NET &CLr,;amSr}%`kyw# 294 pureXML 8O iv 3 `k4 5 ?j}]`k ISO-8859-1 }] ?j&CLr} ]`M V{ &CLrzk3 819 dvod>}: SELECT XMLCOL FROM T1 V{*;:+}]S UTF-8 *;* CCSID 819# *'}]:I\a*'}]#3) UTF-8 V{Z CCSID 819 P^(m>#DB2 }] b53+zIms# XO:;aXO}]# rP/}]PDZ?`k:}]9CTB XML yww*0:: iv 4 `k4 5 ?j}]`k Windows-31J }](Shift_JIS D,/) ?j&CLr} ]`M }: SELECT XMLCOL FROM T1 V{*;:+}]S UTF-8 *;* CCSID 943# *'}]:I\a*'}]#3) UTF-8 V{Z CCSID 943 P^(m>#DB2 }] b53+zIms# XO:IZaxP)9,yTZS UTF-8 *;* CCSID 943 ZdI\a"zXO# rP/}]PDZ?`k:}]9CTB XML yww*0:: `kiv:9CT=D XMLSERIALIZE 4lw XML }] >}5w(}T=XwC XMLSERIALIZE 4lw XML }]1,?j`kM&CLr zk3T}]*;"XOMZ?`kD0l# IZ Java &CLrD&CLrzk3}: SELECT XMLSERIALIZE(XMLCOL AS BLOB(1M) INCLUDING XMLDECLARATION) FROM T1 V{*;:;xPV{*;# *'}]:;a*'}]# XO:;aXO}]# rP/}]PDZ?`k:}]9CTB XML yww*0:: iv 2 `k4 5 ?j}]`k UTF-16 Unicode ?j&CLr} ]`M }: SELECT XMLSERIALIZE(XMLCOL AS CLOB(1M) EXCLUDING XMLDECLARATION) FROM T1 V{*;:+}]S UTF-8 *;* UTF-16# *'}]:;a*'}]# XO:IZaxP)9,yTZS UTF-8 *;* UTF-16 ZdI\a"zXO# rP/}]PDZ?`k:IZ8(K EXCLUDING XMLDECLARATION,yT;P Z?`k#g{8(K INCLUDING XMLDECLARATION,G4Z?`k8> UTF-8 x;G UTF-16#ba}: SELECT XMLSERIALIZE(XMLCOL AS CLOB(1M) EXCLUDING XMLDECLARATION) FROM T1 V{*;:+}]S UTF-8 *;* CCSID 819# *'}]:I\a*'}]#3) UTF-8 V{Z CCSID 819 P^(m>#g{3v V{Z CCSID 819 P^(m>,DB2 }]b\mwMaZdvPekf;V{""v /f# XO:;aXO}]# rP/}]PDZ?`k:IZ8(K EXCLUDING XMLDECLARATION,yT;P Z?`k#g{8(K INCLUDING XMLDECLARATION,}]b\mwMa* UTF-8 x;G ISO-8859-1 mSZ?`k#ba}: SELECT XMLSERIALIZE(XMLCOL AS CLOB(1M) EXCLUDING XMLDECLARATION) FROM T1 V{*;:+}]S UTF-8 *;* CCSID 943# *'}]:I\a*'}]#3) UTF-8 V{Z CCSID 943 P^(m>#g{3v V{Z CCSID 943 P^(m>,}]b\mwMaZdvPekf;V{""v/f# XO:IZaxP)9,yTZS UTF-8 *;* CCSID 943 ZdI\a"zXO# rP/}]PDZ?`k:IZ8(K EXCLUDING XMLDECLARATION,yT;P Z?`k#g{8(K INCLUDING XMLDECLARATION,G4Z?`k8> UTF-8 x;G Windows-31J#baKb)3d#g{`k{4|,Zm 39 P,}]b\mwMa5Xms# m 39 Z;PPDf6/`k{G(}+`k{*;*s4"}%yP,V{"SE" B._"0E"dcMUqC=#}g,ISO88591 G ISO 8859-1"ISO-8859-1 M iso- 8859-1 Df6/`k{# m 39. `k{MP' CCSID f6/`k{ CCSID 437 437 646 367 813 813 819 819 850 850 852 852 855 855 857 857 862 862 863 863 866 866 869 869 885913 901 885915 923 88591 819 88592 912 88595 915 88597 813 88598 62210 88599 920 904 904 912 912 915 915 916 916 920 920 923 923 ANSI1251 1251 ANSIX341968 367 ANSIX341986 367 ARABIC 1089 ASCII7 367 ASCII 367 ASMO708 1089 BIG5 950 CCSID00858 858 298 pureXML 8O m 39. `k{MP' CCSID (x) f6/`k{ CCSID CCSID00924 924 CCSID01140 1140 CCSID01141 1141 CCSID01142 1142 CCSID01143 1143 CCSID01144 1144 CCSID01145 1145 CCSID01146 1146 CCSID01147 1147 CCSID01148 1148 CCSID01149 1149 CP00858 858 CP00924 924 CP01140 1140 CP01141 1141 CP01142 1142 CP01143 1143 CP01144 1144 CP01145 1145 CP01146 1146 CP01147 1147 CP01148 1148 CP01149 1149 CP037 37 CP1026 1026 CP1140 1140 CP1141 1141 CP1142 1142 CP1143 1143 CP1144 1144 CP1145 1145 CP1146 1146 CP1147 1147 CP1148 1148 CP1149 1149 CP1250 1250 CP1251 1251 CP1252 1252 CP1253 1253 CP1254 1254 Z 12 B XML }]`k 299 m 39. `k{MP' CCSID (x) f6/`k{ CCSID CP1255 1255 CP1256 1256 CP1257 1257 CP1258 1258 CP1363 1363 CP1383 1383 CP1386 1386 CP273 273 CP277 277 CP278 278 CP280 280 CP284 284 CP285 285 CP297 297 CP33722 954 CP33722C 954 CP367 367 CP420 420 CP423 423 CP424 424 CP437 437 CP500 500 CP5346 5346 CP5347 5347 CP5348 5348 CP5349 5349 CP5350 5350 CP5353 5353 CP813 813 CP819 819 CP838 838 CP850 850 CP852 852 CP855 855 CP857 857 CP858 858 CP862 862 CP863 863 CP864 864 CP866 866 300 pureXML 8O m 39. `k{MP' CCSID (x) f6/`k{ CCSID CP869 869 CP870 870 CP871 871 CP874 874 CP904 904 CP912 912 CP915 915 CP916 916 CP920 920 CP921 921 CP922 922 CP923 923 CP936 1386 CP943 943 CP943C 943 CP949 970 CP950 950 CP964 964 CP970 970 CPGR 869 CSASCII 367 CSBIG5 950 CSEBCDICCAFR 500 CSEBCDICDKNO 277 CSEBCDICES 284 CSEBCDICFISE 278 CSEBCDICFR 297 CSEBCDICIT 280 CSEBCDICPT 37 CSEBCDICUK 285 CSEBCDICUS 37 CSEUCKR 970 CSEUCPKDFMTJAPANESE 954 CSGB2312 1383 CSHPROMAN8 1051 CSIBM037 37 CSIBM1026 1026 CSIBM273 273 CSIBM277 277 CSIBM278 278 Z 12 B XML }]`k 301 m 39. `k{MP' CCSID (x) f6/`k{ CCSID CSIBM280 280 CSIBM284 284 CSIBM285 285 CSIBM297 297 CSIBM420 420 CSIBM423 423 CSIBM424 424 CSIBM500 500 CSIBM855 855 CSIBM857 857 CSIBM863 863 CSIBM864 864 CSIBM866 866 CSIBM869 869 CSIBM870 870 CSIBM871 871 CSIBM904 904 CSIBMEBCDICATDE 273 CSIBMTHAI 838 CSISO128T101G2 920 CSISO146SERBIAN 915 CSISO147MACEDONIAN 915 CSISO2INTLREFVERSION 367 CSISO646BASIC1983 367 CSISO88596I 1089 CSISO88598I 916 CSISOLATIN0 923 CSISOLATIN1 819 CSISOLATIN2 912 CSISOLATIN5 920 CSISOLATIN9 923 CSISOLATINARABIC 1089 CSISOLATINCYRILLIC 915 CSISOLATINGREEK 813 CSISOLATINHEBREW 62210 CSKOI8R 878 CSKSC56011987 970 CSMACINTOSH 1275 CSMICROSOFTPUBLISHING 1004 CSPC850MULTILINGUAL 850 302 pureXML 8O m 39. `k{MP' CCSID (x) f6/`k{ CCSID CSPC862LATINHEBREW 862 CSPC8CODEPAGE437 437 CSPCP852 852 CSSHIFTJIS 943 CSUCS4 1236 CSUNICODE11 1204 CSUNICODE 1204 CSUNICODEASCII 1204 CSUNICODELATIN1 1204 CSVISCII 1129 CSWINDOWS31J 943 CYRILLIC 915 DEFAULT 367 EBCDICATDE 273 EBCDICCAFR 500 EBCDICCPAR1 420 EBCDICCPBE 500 EBCDICCPCA 37 EBCDICCPCH 500 EBCDICCPDK 277 EBCDICCPES 284 EBCDICCPFI 278 EBCDICCPFR 297 EBCDICCPGB 285 EBCDICCPGR 423 EBCDICCPHE 424 EBCDICCPIS 871 EBCDICCPIT 280 EBCDICCPNL 37 EBCDICCPNO 277 EBCDICCPROECE 870 EBCDICCPSE 278 EBCDICCPUS 37 EBCDICCPWT 37 EBCDICCPYU 870 EBCDICDE273EURO 1141 EBCDICDK277EURO 1142 EBCDICDKNO 277 EBCDICES284EURO 1145 EBCDICES 284 Z 12 B XML }]`k 303 m 39. `k{MP' CCSID (x) f6/`k{ CCSID EBCDICFI278EURO 1143 EBCDICFISE 278 EBCDICFR297EURO 1147 EBCDICFR 297 EBCDICGB285EURO 1146 EBCDICINTERNATIONAL500EURO 1148 EBCDICIS871EURO 1149 EBCDICIT280EURO 1144 EBCDICIT 280 EBCDICLATIN9EURO 924 EBCDICNO277EURO 1142 EBCDICPT 37 EBCDICSE278EURO 1143 EBCDICUK 285 EBCDICUS37EURO 1140 EBCDICUS 37 ECMA114 1089 ECMA118 813 ELOT928 813 EUCCN 1383 EUCJP 954 EUCKR 970 EUCTW 964 EXTENDEDUNIXCODEPACKEDFORMATFORJAPANESE 954 GB18030 1392 GB2312 1383 GBK 1386 GREEK8 813 GREEK 813 HEBREW 62210 HPROMAN8 1051 IBM00858 858 IBM00924 924 IBM01140 1140 IBM01141 1141 IBM01142 1142 IBM01143 1143 IBM01144 1144 IBM01145 1145 IBM01146 1146 304 pureXML 8O m 39. `k{MP' CCSID (x) f6/`k{ CCSID IBM01147 1147 IBM01148 1148 IBM01149 1149 IBM01153 1153 IBM01155 1155 IBM01160 1160 IBM037 37 IBM1026 1026 IBM1043 1043 IBM1047 1047 IBM1252 1252 IBM273 273 IBM277 277 IBM278 278 IBM280 280 IBM284 284 IBM285 285 IBM297 297 IBM367 367 IBM420 420 IBM423 423 IBM424 424 IBM437 437 IBM500 500 IBM808 808 IBM813 813 IBM819 819 IBM850 850 IBM852 852 IBM855 855 IBM857 857 IBM862 862 IBM863 863 IBM864 864 IBM866 866 IBM867 867 IBM869 869 IBM870 870 IBM871 871 IBM872 872 Z 12 B XML }]`k 305 m 39. `k{MP' CCSID (x) f6/`k{ CCSID IBM902 902 IBM904 904 IBM912 912 IBM915 915 IBM916 916 IBM920 920 IBM921 921 IBM922 922 IBM923 923 IBMTHAI 838 IRV 367 ISO10646 1204 ISO10646UCS2 1200 ISO10646UCS4 1232 ISO10646UCSBASIC 1204 ISO10646UNICODELATIN1 1204 ISO646BASIC1983 367 ISO646IRV1983 367 ISO646IRV1991 367 ISO646US 367 ISO885911987 819 ISO885913 901 ISO885915 923 ISO885915FDIS 923 ISO88591 819 ISO885921987 912 ISO88592 912 ISO885951988 915 ISO88595 915 ISO885961987 1089 ISO88596 1089 ISO88596I 1089 ISO885971987 813 ISO88597 813 ISO885981988 62210 ISO88598 62210 ISO88598I 916 ISO885991989 920 ISO88599 920 ISOIR100 819 306 pureXML 8O m 39. `k{MP' CCSID (x) f6/`k{ CCSID ISOIR101 912 ISOIR126 813 ISOIR127 1089 ISOIR128 920 ISOIR138 62210 ISOIR144 915 ISOIR146 915 ISOIR147 915 ISOIR148 920 ISOIR149 970 ISOIR2 367 ISOIR6 367 JUSIB1003MAC 915 JUSIB1003SERB 915 KOI8 878 KOI8R 878 KOI8U 1168 KOREAN 970 KSC56011987 970 KSC56011989 970 KSC5601 970 L1 819 L2 912 L5 920 L9 923 LATIN0 923 LATIN1 819 LATIN2 912 LATIN5 920 LATIN9 923 MAC 1275 MACEDONIAN 915 MACINTOSH 1275 MICROSOFTPUBLISHING 1004 MS1386 1386 MS932 943 MS936 1386 MS949 970 MSKANJI 943 PCMULTILINGUAL850EURO 858 Z 12 B XML }]`k 307 m 39. `k{MP' CCSID (x) f6/`k{ CCSID R8 1051 REF 367 ROMAN8 1051 SERBIAN 915 SHIFTJIS 943 SJIS 943 SUNEUGREEK 813 T101G2 920 TIS20 874 TIS620 874 UNICODE11 1204 UNICODE11UTF8 1208 UNICODEBIGUNMARKED 1200 UNICODELITTLEUNMARKED 1202 US 367 USASCII 367 UTF16 1204 UTF16BE 1200 UTF16LE 1202 UTF32 1236 UTF32BE 1232 UTF32LE 1234 UTF8 1208 VISCII 1129 WINDOWS1250 1250 WINDOWS1251 1251 WINDOWS1252 1252 WINDOWS1253 1253 WINDOWS1254 1254 WINDOWS1255 1255 WINDOWS1256 1256 WINDOWS1257 1257 WINDOWS1258 1258 WINDOWS28598 62210 WINDOWS31J 943 WINDOWS936 1386 XEUCTW 964 XMSWIN936 1386 XUTF16BE 1200 XUTF16LE 1202 308 pureXML 8O m 39. `k{MP' CCSID (x) f6/`k{ CCSID XWINDOWS949 970 + CCSID 3dArP/ XML dv}]D`k{ w*~=rT= XMLSERIALIZE YwD;?V,DB2 }]b\mwI\aZrP/ XML dv}]*7mS`kyw# CywDq=gBy>: (#,`kywPDV{/j6hvdvV{.PDV{`k#}g,Z+ XML }] rP/*k?j&CLr}]`MT&D CCSID 1,`kyw+hv?j&CLrd ? CCSID#&CLr4P8(K INCLUDING XMLDECLARATION DT= XMLSERIALIZE /}1Div}b#g{8(K INCLUDING XMLDECLARATION, }]b\mwMa* UTF-8 zI`kyw#g{?j}]`MG CLOB r DBCLOB `M,MI\a4Pd{zk3*;Yw,ba},G) >}5wK(}b)"MIT8(DZ]# x"MD#=D5Xkf"Z XML #=f"b (XSR) P"rCf"b"a#;s, XkTC#=tCVb# ZI&"ax"MD#=s,IT(}wCdP;vVbf"}Lr4P DECOM- POSE XML DOCUMENT |n44P%v XML D5DVb#*Vbf"Z3PPD `v XML D5,k9C XDB_DECOMP_XML_FROM_QUERY f"}Lr DECOM- POSE XML DOCUMENTS |n# k"b,IT{CyZ#=DVb,2IT9.''#PX|`E",kNDPX{ CVbDwb# x"MD XML #=VbDEc x"MD XML #=VbITGbvTBJbDbv=8:*+{O XML #=D XML D5f"ZmP,+C#=kf"D5DmD(e;j+%d# Z XML #=kma9;wT%dDivB,I\h*w{ XML #=M/rX5# =,T9D5JOma9#+G,"G\G\;T XML rX5#=xP|D,r_b V|DI\G#:s,XpGZVP&CLrZ{X5#=_PX(a91# x"MD XML #=VbJmzy]VPDrBD XML #=+D5VbIVPmrB m,SxbvKKJb#IZx"MD XML #=VbPa)DwV&\,yTIT5 VOvYw#b)&\(|Gm>*mSA XML #=D5D"M)9CITinX+ XML #=a93dAX5ma9# 9Cx"MD XML #=4Vb XML D5 1zk*+ XML D5Dwv?Vf"Z;vr`vmDPP1,IT9Cx"MD XML #=Vb#K`Vb&\y]Q"aDx"MD XML #=P8(D"M4T XML D5xPVb,Tcf"ZmP# XZKNq *9Cx"MD XML #=4Vb XML D5: © Copyright IBM Corp. 2006, 2013 315 }L 1. g{z*9CSOgf>D DB2 }]bz74(D}]b,G4k9CPmD~ xdb.lst KP BIND |n,IZ sqllib/bnd ?DdP;V=("a) XML # =D XSR Ts{: v TZD~53OD%v XML D5,9CBPdP;V=(: – wCs!UCJOZyVbD5s!DdP;v XDBDECOMPXML f"} L#3 – "v DECOMPOSE XML DOCUMENT |n# v TZf"Z~xFPr XML PPD;vr`vD5,9CBPdP;V=(: – "v DECOMPOSE XML DOCUMENTS |n# – wC XDB_DECOMP_XML_FROM_QUERY f"}L# a{ "a XML #="TdtCVb ;)I&X"ax"MD#="TdtCVb,MIT9C|4Vb XML D5# *<.0 v 7#9C XML Vb"MT XML #=PDAY;v*XrtTywmSK"M#K x"M*XrtTXkG4S`MD+V*XDS*X,r_>mG4S`MD+ V*X# v 7#}]bPfZSx"MD#=D5/P}CDyPmMP,K#=D5/iI K XML #=#ZC#=}CD?vmMT&ZC#=D XSR Ts.d4(@5X 5# v 7# applheapsz dCN}AYhC* 1024# }L !qBPdP;V=(4"a XML #="TdtCVb:4 v f"}L: 1. wC XSR_REGISTER f"}L"+]w#=D5# 2. g{C XML #=I`v#=D5iI,kT?vP4"aD#=D5wC XSR_ADDSCHEMADOC f"}L# 3. wC XSR_COMPLETE f"}L"+ isusedfordecomposition N}hC* 1# v |nP: 3. g{}Z9CE>r&CLr4VbtIv4*s!DD5,k} DECOMPOSE XML DOCUMENTS |n9C%v XML #=4Vbf"Z~xFPr XML PPD;i XML D5#XML D5}]y]#=Py8(D"M4f"ZX5 mDwPP# >} TB>}Y( ABC.SALESTAB X5mP|, SALESDOC M DOCID b=P# SALESDOC P|, XML D5,x DOCID P|,f"Z SALESDOC PD XML D 5DD5j6#yPD5kZ XML #=f"b (XSR) P"a* ABC.SALES D XML #=T&,Q(}VbE"TK#=mSK"MRICZVb#wCTB DECOM- POSE XML DOCUMENTS |n,T9C ABC.SALES #=4Vbf"Z ABC.SALESTAB.SALESDOC PDyPD5: DECOMPOSE XML DOCUMENTS IN ’SELECT DOCID, SALESDOC FROM ABC.SALESTAB’ XMLSCHEMA ABC.SALES MESSAGES /home/myid/errors/errorreport.xml r_,9C XDB_DECOMP_XML_FROM_QUERY f"}L4Vb XML D5#TB f"}L+k0;|n4P`,DVbYw# XDB_DECOMP_XML_FROM_QUERY (’ABC’, ’SALES’, ’SELECT DOCID, SALESDOC FROM SALESTAB’, 0, 0, 0, NULL, NULL, 1, numInput, numDecomposed, errorreportBuf); TB|n+9C CUST_SHRED #=4Vb CUSTOMER mD INFO P CUSTID s Z 1003 DM'E"#K>}Y(QZ XSR P"aK CUST_SHRED #=# DECOMPOSE XML DOCUMENTS IN ’SELECT CUSTID, INFO FROM CUSTOMER WHERE CUSTID > 1003’ XMLSCHEMA CUST_SHRED MESSAGES /home/myid/errors/errorreport.xml 5. K=(P=Vq=:;Vq=CZS InputStream TsdkD XML #=D5,m;Vq=CZ String PD XML #=D5# Z 13 B x"MD XML #=Vb 317 x"MD XML #=VbM]i XML D5 IZ XML #=f"b (XSR) P"a|,]iD XML #="TdtCVb#+G, ]iX5>m^(w*j?5Vb=?jmP# (}9C`&D#="M,I(}rP/jGD==f""lw]i?V# ]i`M 1 XML #=PD`M(eJm_P`,{FM`MD*XvVZT:D(eP1, XML #=a;O*G]i XML #=#]iITGT=r~=D# T=]i @]Tm(e*X1,M"zT=]i#gTB>}Py>,(}9C ref * XywtT,*X ZT:D(ePT=}CT:: TZT=]i,]iV'(ggB: v ]iV'D*7G*X Y Dyw,dfz"4|,m;v Y D*Xyw# ]iV'D*7IP`vSV';TZX(SV',g{V'|,m;v Y D*Xyw,G4CV';S*]iV'# v ]iV'Da2Gd1V'*7szD Y Dn_6p*Xyw#"b,V' Da2_eD5G*X}C# w*]iV'*7DZcId1`v]iV'Dp}P,P =vT=]iV': 1. (*), , (**) 2. (*), , (***) 318 pureXML 8O ]iV'hvdI1*XgNVb#Z5}D5P,T&Z]iV'*7D* X Y DvV"dsz1=T&ZCV'a2D Y DvV }Py>,*X }C`M“rootType”,x*X >mtZ*(eD`M“rootType”: TZ~=]i,]iV'(ggB: v ]iV'D*7G_P complexType `M CT D*X Y Dyw,dfz" 4|,`M* CT Dm;*Xyw#]iV'D*7IP`vSV';TZX (SV',g{V'|,m;v`M* CT D Z D*Xyw,G4CV'; S*]iV'# v ]iV'Da2Gd1V'*7szD`M* CT Dn_6p*Xyw# w*]iV'*7DZcId1`v]iV'Dp}P,P =v~=]iV': 1. , , 2. , , kT=]i`H,~=`MD]iDVb==PYmnp#Z5}D5P,T &Z]iV'*7D*X Y DvV"dsz1=T&ZCV'a2D Z Dv V (identified with *), , (identified with **)) 2. RB2 (, ) TB>}P;vT>DGX*5}D5D]ixr#5}D5PP=v RB2 5}( M ),+;PZ;v RB2 5}(I # j6D )DG]ixrIVb*j? 5#4,IVbtT id="1"#Z~v RB 5}DG]ixrj+ZZ~v;vT>x rP,|G RB1 5}D]ixr#rK,;\VbtT id="2"# a str1 c str1 a str11 c str11 320 pureXML 8O >}:+ db2-xdb:contentHandling Vb"Mk=V`MD]idO9 C K>}5wT=]i`MM~=]i`MDVbP*,T0T db2-xdb:contentHandling "MhC;,5zzDa{#ZTB=v XML 5}D5P,]ixrQ;vT># ZD5 1 P,1 *XvVZ|T:Bf1,]i*<: a str1 c str1 a str11 c str11 ZD5 2 P,]iS*X BfD*X*<: a str2 c str2 a str22 c str22 Z5}D5P,yP*XrtT0dvVZ]i*7Ma2.dDZ];\Vb*m -PTPDj?5#+G,I(}T]iV'PD*X(`M* complexType)mS" M"+ db2-xdb:contentHandling tThC*“serializeSubtree”4q!]i*7ka2.d wnDrP/jGf>#9I(}+ db2-xdb:contentHandling hC*“stringValue”4q !K?VPyPV{}]DD>rP/#\.,(}T]iV'DNN complexType * Xrd1]iV'PD*XDfzD*XhC`&D db2-xdb:contentHandling tT,I q!]i76DZ]rjG# }g,ZTB XML #=PT*X mS"M: Z 13 B x"MD XML #=Vb 321 c str1 a str11 c str11 ,y,ZTB XML #=PT*X“beginRecursion”mS"M: a str22 c str22 {Cx"MD XML #=Vb DB2 Z3)ivBI9x"MD XML #=Vb'',C'2ITT=X+d{C# 9Vb''Du~ TZH0Q"a"tCKVbDx"MD#=45,g{zcBPNNu~,MaT /9yZ#=DVb''#(k"b,Q9dVb''D XML #=TICZVbOB Db?y4PDi$,}gCZ XMLVALIDATE SQL/XML /}#)TZ?vu~, P>KXBtCVb1yh4PD|}Yw# 322 pureXML 8O m 41. 9Vb''Du~T0`&D|}Yw u~ CZXBtCVbDYw "MP}CDmQ;Oz S#=D5P}%TQ>}DmD}C,XB "a{vx"MD#=,;sTC#=tCV b "MPy}CPD}]`MQ|D*k XML #=`Mf]D`M (}4P8(K ENABLE DECOMPOSITION !nD ALTER XSROBJECT SQL od,TC #=XBtCVb "MPy}CPD}]`MQ|D*k XML #=`M;f]D`M y]h*w{"M,XB"a{vx"MD# =,;sTC#=tCVb tZx"MD#=DD5Q|D XB"ayP9IC#=DD5,;sTC# =tCVb *Kb|`E",kNDPX"ax"MD#=MtCVbDNqD5# T={C (}4PBPNN;v SQL od"8(ky*{CDx"MD#=`T&D XSR T s,ITT=X{CyZ#=DVb: v 8(K DISABLE DECOMPOSITION !nD ALTER XSROBJECT ":{CKVbD XML #=TICZi$# v 8(K XSROBJECT !nD DROP ":!qD!n!vZ XML #=DC>#g{C#=CZi$,G4&CTd{CV b,x;G+d>}#g{C#=vCZVb,"Rz;kYN+dCZVb,G4 IT>} XSR Ts# CZx"MD#=VbD xdbDecompXML }L IT(}wC 10 vZC}LDdP;v4wCx"MD XML #=Vb,b+Vb% v XML D5# x"MD XML #=Vb}L: v xdbDecompXML v xdbDecompXML10MB v xdbDecompXML25MB v xdbDecompXML50MB v xdbDecompXML75MB v xdbDecompXML100MB v xdbDecompXML500MB v xdbDecompXML1GB v xdbDecompXML1_5GB v xdbDecompXML2GB Z 13 B x"MD XML #=Vb 323 b)}LvvG xmldoc N}Ds!Py;,,CN}8(*VbDdkD5Ds!# kwCs!UCJOZy*VbDD5s!D}L,TcnsLHX5M53Zf9 C?#}g,*Vbs!* 1MB DD5,k9C xdbDecompXML }L# TB?VPa)K xdbDecompXML Do(;kND xmldoc N}DhvTKbkT xdbDecompXML10MB"xdbDecompXML25MB"xdbDecompXML50MB" xdbDecompXML75MB"xdbDecompXML100MB"xdbDecompXML500MB" xdbDecompXML1GB"xdbDecompXML1_5GB M xdbDecompXML2GB }LD xmldoc N}f6# o( xdbDecompXML ( rschema , xmlschemaname , xmldoc , documentid , validation , reserved , reserved , reserved ) K}LD#=* SYSPROC# (^ tZwCK}LDodDZ(j6Xk5PBPdP;nX(r(^: v h*BPyPX(: – Tx"MD#=P}CDyP?jmD INSERT X( – T db2-xdb:expression r db2-xdb:condition "M}CDNNmD SELECT"INSERT"UPDATE r DELETE X((g{JC) v Tx"MD#=D5/P}CDyP?jmD CONTROL X( v DATAACCESS (^ g{ validation D5* 1,G4tZwCK}LDodDZ(j6XkT XML #=_ 8 USAGE X(# }LN} rschema VARCHAR(128) `MDdkN},|8(r XML #=f"b"aD=?V XSR Ts{D SQL #=?V#g{K5* NULL,G4Y( SQL #=?VG CUR- RENT SCHEMA (CDfwD105# xmlschemaname VARCHAR(128) `MDdkN},|8(r XML #=f"b"aD=?V XSR Ts{D#={#K5;\* NULL# xmldoc BLOB(1M) `MDdkN},|8(|,y*VbD XML D5D:ex# ": v TZ xdbDecompXML10MB }L,KN}D`M* BLOB(10M)# v TZ xdbDecompXML25MB }L,KN}D`M* BLOB(25M)# v TZ xdbDecompXML50MB }L,KN}D`M* BLOB(50M)# v TZ xdbDecompXML75MB }L,KN}D`M* BLOB(75M)# 324 pureXML 8O v TZ xdbDecompXML100MB }L,KN}D`M* BLOB(100M)# v TZ xdbDecompXML500MB }L,KN}D`M* BLOB(500M)# v TZ xdbDecompXML1GB }L,KN}D`M* BLOB(1G)# v TZ xdbDecompXML1_5GB }L,KN}D`M* BLOB(1.5G)# v TZ xdbDecompXML2GB }L,KN}D`M* BLOB(2G)# documentid VARCHAR(1024) `MDdkN},|8(y*VbDdk XML D5Dj6#K N}Pa)D5+f;`& XML #=PD db2-xdb:expression r db2- xdb:condition "MP8(D $DECOMP_DOCUMENTID# validation INTEGER `MDdkN},|8>GqTyVbDD54Pi$#I\D5|(: 0 ZVbdkD50;Td4Pi$# 1 y]H0r XML #=f"b"aD DTD r XML #=D54TdkD54 Pi$#;Pi$I&sEVbdk XML D5# reserved reserved N}G*+49Cx#tDdkN}#*b)N}+]D5XkG NULL# dv K}L;PT=DdvN}#kli SQLCA a9D sqlcode VNTKbVbZd"z DNNms#jIVbs,I\D sqlcode 5gBy>: 0 QI&XVbKD5# }{} QI&XVbKD5,+"zK/fiv#b)/fGD~P, CD~;ZWNvV}]6q(FODC)f"?KJO-r#kli db2diag U>D~TKbPXJ ODj8E"# 9C5w b)}LZ9CAH(Ttk6pDivB4P# b)}LT-S==KP;g{}LZ4PZd'\,MaXvK}L4PDyPY w#IZK}L>m";4P COMMIT SQL od,rK,*d5K}LywD|D, wC_Xk4P COMMIT od# g{}Z9CE>r&CLr4VbtIv4*s!DD5,k} Qr XML #=f"b+x"MD XML #="a* ABC.TEST,C#=8> XML 5 y*Vb*DmMP#*+ XML D5Vb=X5mP,k4gBwCJ1D}L: CALL xdbDecompXML (’ABC’, ’TEST’, BLOB(’Hello world’), ’DOCID’, 0 , NULL, NULL, NULL) Z 13 B x"MD XML #=Vb 325 DECOMPOSE XML DOCUMENT wCf"D}LT9CQ"aMtCVbD XML #=Vb%v XML D5# (^ h*BPdPD;vX(r(^i: v BPdP;v(^: – Tx"MD#=D5/P}CDyP?jmD CONTROL X( – DATAACCESS (^ v h*BPyPX(: – YwD~P8(DYwyhD?jmOD INSERT X( – T db2-xdb:expression r db2-xdb:condition "M}CDNNmD SELECT"INSERT"UPDATE r DELETE X((g{JC) g{8( VALIDATE !n,G49h*T XML #=_8 USAGE X(# XhD,S Database |no( DECOMPOSE XML DOCUMENT xml-document-name XMLSCHEMA xml-schema-name VALIDATE |nN} DECOMPOSE XML DOCUMENT xml-document-name xml-document-name G*VbDdk XML D5DD~76MD~{# XMLSCHEMA xml-schema-name xml-schema-name Gr XML #=f"b "aDVP XML #=D{F,IC ZD5Vb#xml-schema-name GOqD SQL j6,Isz;vdcM XML #={FDI! SQL #={FiI#g{48( SQL #={,G4Y(|G DB2 (CDfw CURRENT SCHEMA D5# VALIDATE KN}8>,dk XML D5GWH*i$D,;sGvZCD5P'1EV b#g{48( VALIDATE,G4ZxPVb.0;ai$dk XML D5# >} TB>}8(*i$D XML D5 ./gb/document1.xml,"C"aD XML #= DB2INST1.GENBANKSCHEMA xPVb# DECOMPOSE XML DOCUMENT ./gb/document1.xml XMLSCHEMA DB2INST1.GENBANKSCHEMA VALIDATE 326 pureXML 8O BP>}8( XML D5 ./gb/document2.xml *Z;P9C"ai$D XML #= DB2INST2.″GENBANK SCHEMA1″ i$DivBxPVb,bGY(+ DB2 (CD fw CURRENT SCHEMA D5hC* DB2INST2# DECOMPOSE XML DOCUMENT ./gb/document2.xml XMLSCHEMA "GENBANK SCHEMA1" x"MD#=VbD XDB_DECOMP_XML_FROM_QUERY f"}L Kf"}LCZVb~xFD~r XML PPD;vr`v XML D5#XML D5} ]y] XML #=Py8(D"M4f"ZX5mDwPP# o( XDB_DECOMP_XML_FROM_QUERY ( rschema , xmlschema , query , validation , commit_count , allow_access , reserved , reserved2 , continue_on_error , total_docs , num_docs_decomposed , result_report ) Kf"}LD#=* SYSPROC# K}LZ9CAH(Ttk6pDivB4P# (^ h*TBdP;n(^rX(: v h*BPyPX(: – Tx"MD#=P}CDyP?jmD INSERT X( – TZ_PdkD5DP,zh*T|,KPDm"p{rS<_8 SELECT X( – T db2-xdb:expression r db2-xdb:condition "M}CDNNmD SELECT"INSERT"UPDATE r DELETE X((g{JC) v TZx"MD#=D5/P}CDyPm_P CONTROL X(;"RTZ_Pdk D5DP,zh*T|,KPDm"p{rS<2_8 CONTROL X(# v DATAACCESS (^ g{ validation D5* 1,G49h*T XML #=_8 USAGE X(# }LN} rschema VARCHAR(128) `MDdkN},|8(r XML #=f"b"aD=?V XSR Ts{D SQL #=?V#K5I* NULL#g{K5* NULL,G4Y( SQL # =?VG CURRENT SCHEMA (CDfwD105# xmlschema VARCHAR(128) `MDdkN},|8(r XSR "aD=?V XSR Ts{D{ F#K5;\* NULL# query CLOB(1MB) `MDdkN}#K5;\* NULL#query {O SQL SELECT o Z 13 B x"MD XML #=Vb 327 dDfr,"RXk5X;v|,=PDa{/#Z;PGD5j6#?vD5j 6+(;Xj6*VbD XML D5#KPXkGV{`Mr_I*;*V{` M # Z ~ P | , * V b D XML D 5 # D 5 P D \ ' V ` M P XML"BLOB"VARCHAR FOR BIT DATA M LONG VARCHAR FOR BIT DATA#|, XML D5DPXkbv*Wcy>mDP,CP;\*zIDP# }g,TB SELECT odPD DOCID P|,f"Z SALESDOC PPD XML D5D(;j6# SELECT DOCID, SALESDOC FROM SALESTAB validation INTEGER `MDdkN},|8>GqZVbD5.0TD54Pi$#I\D5 |(: 0 ZVbdkD5.0;Tb)D54Pi$# g{+]D5* 0 "R44Pi$,G4ZwCf"}L.0+IC':pi $D5#}g,+ XML D5ekPP1,C'IT9C XMLVALIDATE,r _ZekD5.09C XML &mw#g{dk XML D5^'"R*KN} 8(D5* 0,G4Vba{4(e# 1 +kTH0Qr XML #=f"b"aD DTD r XML #=D54TdkD 54Pi$#v1i$I&.sEaVbdk XML D5# commit_count `M* INTEGER DdkN}#I\D5|(: 0 f"}L44P} COMMIT od# n(;v}{}) ?1 n NTD5I&xPVb.s,Ma4P COMMIT od# allow_access `M* INTEGER DdkN}#I\D5|(: 0 TZ_P XML #=PD3dDyPm,f"}L+qCTZb)mD%bx ((X)#ZVb?vD5Zd,";GyPmK4I&VbD?vdkD~D{FM;uoO{"#v1AYP;v4\ I&VbD XML D51,EazIK(f# result_report PD XML D5Dq=*gBy>: sssss qqqqq ... ... D5j65 sssss GI query 8(DZ;PPD5#K5j64I&VbD XML D5#ms{"5 qqqqq GZ"TVbD5Zdv=Dms# dv SQLCA a98>Z"TVb XML D5.s}LD5X4,#}LI\a5XBPd P;v SQLCODE 5: 0 I&VbKI query 8(DyPD5# 16278 Vb;vr`vD5'\#I&VbDD5}If"}LD num_docs_decomposed dvN}x(#?v'\DD5%@Dms{"GD~PGJO-r#kli db2diag U>D~TKbPX JODj8E"# "b f"}LhzBPXw4xPyw: DYNAMIC RESULT SETS 0 NOT DETERMINISTIC UNFENCED THREADSAFE MODIFIES SQL DATA PARAMETERSTYLE SQL CALLED ON NULL INPUT NEW SAVEPOINT LEVEL DBINFO Z 13 B x"MD XML #=Vb 329 >} TB>}Y( ABC.SALESTAB mP|, SALESDOC M DOCID b=P#SALESDOC P|, XML D5,x DOCID P|, SALESDOC PD XML D5D(;j6#y P XML D5T&Zw* ABC.SALES "aD XML #=,Q9CVbE""MKK #="R'VVb#TB>}+wCKf"}L,T9C ABC.SALES #=4Vbf" Z SALESDOC PDD5: XDB_DECOMP_XML_FROM_QUERY (’ABC’, ’SALES’, ’SELECT DOCID, SALESDOC FROM ABC.SALESTAB’, 0, 0, 0, NULL, NULL, 1, numInput, numDecomposed, errorreportBuf); XML Vb"M x"MD XML #=Vby] XML #=D5PmSD"MxP#b)Vb"Md1 XML D5*XrtTk}]bP?jmMP.dD3d#Vb&m}Cb)"MT7( XML D5Vb==# XML Vb"MtZ http://www.ibm.com/xmlns/prod/db2/xdb1 {FUd,ZD5P,b )"MI“db2-xdb”0:j6#zIT!qT:D0:;+G,g{byv,MXk+ C0:kTB{FUds(:http://www.ibm.com/xmlns/prod/db2/xdb1#Vb}Lv6 pTC XML #=tCVb1ZK{FUdBD"M# v1+Vb"MmS=#=D5PD*XMtTywr_w*+V"MmS|G1, Vb}LE\6p|G#|GGw**XrtTywD S*XDtTr iI?V8(D#mS=4S`M"}Crd{ XML #=9lPD"M+;vT# d;|,Z XML #=D5P,+b)"M";a0l#=D5D-8 (b)"M: db2-xdb:rowSet M db2-xdb:column "MvJCZ{* ISBN Dbv*X# 330 pureXML 8O w*a9/S*XD"M XkZ#=D5P XML #=y(e cNa9Z8(*w**XrtTywDa9/S*XD"M# }g,I4gBy>+ db2-xdb:rowSet M db2-xdb:column "M8(*S*X(|GG "MDS*X): TEXTBOOKS ISBN + db2-xdb:rowSet M db2-xdb:column "M8(*S*Xk+b)"M8(*tT`, (Z0fQ-5wKb;c)#k+"M8(*tTD=(`H,d;+"M8(* S*X*4S\`,+Zh*T;v*XrtT8(`v 1 (4,h*Z,;*XrtTywP8(`v3d1),9Gh*+"M8(*S* X# +V"M 1"M;8(* *XDS*X1,|MGJCZiI XML #=DyP XML #=D5D+V"M# }g, "M8> XML #=P}CDyP4^(mD1! SQL #=#Xk+ 8(* DS*X: admin ... Kyw8(iIK XML #=DyP#=D5ZDyP4^(Dm+_P SQL #= “admin”# kND_e"MDD5T7(ITgN8(X("M# XML Vb"M - \a DB2 'VIx"MD XML #=Vb}L9CD;i"M,Ci"MCZ+ XML D 5PD*XMtT3dA?j}]bm#BfT;) XML Vb"MwKE(,b)\ a4Uz9C"M44PDNqMYwxPVi# * K b P X X ( " M D | ` E " , k N D P X C " M D j8D 5 # Z 13 B x"MD XML #=Vb 331 m 42. 8( SQL #= Yw XML Vb"M *yP48( SQL #=Dm8(1! SQL # = db2-xdb:defaultSQLSchema *X(Dm8(;,Z1! SQL #=D SQL #= db2-xdb:table( S*X) m 43. + XML *XrtT3dA?jy>m Yw XML Vb"M +%v*XrtT3dA%vm/PT db2-xdb:rowSet(8( db2-xdb:column w*tT "M)r db2-xdb:rowSetMapping +%v*XrtT3dA;vr`v@XDm/ PT db2-xdb:rowSetMapping +`v*XrtT3dA%vm/PT db2-xdb:table 8(?jm.dDEr@5T db2-xdb:rowSetOperationOrder, db2-xdb:rowSet, db2-xdb:order m 44. 8(*VbD XML }] Yw XML Vb"M 8(**4S`M*XekDZ]`M(D >"V{.rjG) db2-xdb:contentHandling 8(ekZ]0*4PDNNZ]d;Yw db2-xdb:normalization, db2-xdb:expression, db2-xdb:truncate y]nDZ]r|yZDOBDT*VbD} ]xP}K db2-xdb:condition db2-xdb:locationPath db2-xdb:defaultSQLSchema Vb"M db2-xdb:defaultSQLSchema "M8(Z49C db2-xdb:table "MxPT=^(DivB, XML #=P}CDyPm{D1! SQL #=# tZImS= XML #=D5PDVb"M/,9C|4 hv XML D5*XMtTk DB2 y>m.dD3d#Vb}L9Cx"MD XML #=47(&CgN+ XML D5*XMtTVb= DB2 mP# "M`M w*+V *XSzD DS*X# gN8( (}TB=(48( db2-xdb:defaultSQLSchema(dP value m>P'"M5): value 332 pureXML 8O ... {FUd http://www.ibm.com/xmlns/prod/db2/xdb1 P'5 U( SQL #={r(g SQL #={#U( SQL #={(4,4(g SQL #={) ;xVs!4#*8((g SQL #=,k9C(#C4T SQL j6xP(gD}E# Z XML #=D5P,XkT|,XbV{“<”M“&”D SQL #={xP*e# j8E" TZx"MD#=P}CDyPm45,Xk9C|GD SQL #=4T|GxP^(# IT(}=V=(TmxP^(:T=X8( "MD S*X,r_9C +V"M#TZNN 4^(m{45,+ P8(D5Cw|D SQL #={# g{Z;vx"MD#=PP`v#=D58(KK"M,G4yP5Xk`,# >} TB>}5wgN+U( SQL j6(4,4(g SQL j6)admin (eIx"MD #=PyP4^(mD SQL #=: admin ... TB>}5wgN+(g SQL j6 admin schema (eIx"MD#=PyP4^( mD SQL #=#k"b,Xk9C}E4T admin schema xP(g# "admin schema" ... db2-xdb:rowSet Vb"M db2-xdb:rowSet "M8( XML *XrtT=?jy>mD3d# db2-xdb:rowSet tZImS= XML #=D5PDVb"M/,9C|4hv XML D 5*XMtTk DB2 y>m.dD3d#Vb}L9Cx"MD XML #=47(& CgN+ XML D5*XMtTVb= DB2 mP# Z 13 B x"MD XML #=Vb 333 "M`M r DtT,r_ r DS*X# gN8( (}BPNN;V=(48( db2-xdb:rowSet(dP value m>P'"M5): v v v value ... v value ... {FUd http://www.ibm.com/xmlns/prod/db2/xdb1 P'5 NN{O SQL j6frDj6#PX|`E",kNDj6D5# j8E" db2-xdb:rowSet "M+ XML *XrtT3dA?jy>m#K"MIT1Sj6m{, 2ITj6O*4SD3dPDP/{(ZbVivB,(} db2-xdb:table "M9CP /km{`X*)#Zr%3dP,K"M8(*+5Vb=DmD{F#ZO*4 SD3dP,`vP/(?vP/D{F%;`,)3dA,;vm,yTK"M8 (P/x;Gm{# K XML *X5rtT5+;Vb=D?jy>mGI9Ix"MD#=D#=D5/ Pd{"M7(D: v g{ db2-xdb:rowSet 5k +V"MDNN S* X<;%d,G4?jm{GK"M8(D5,"R9C +V"M(eD SQL #=xP^(#db2-xdb:rowSet DbVC(CZTBiv:T ZX(Dm,;P;i*XrtT3dACm# v g{ db2-xdb:rowSet 5k +V"MD S*X% d,G4?jm{G D SzP8(Dm{#db2- xdb:rowSet DbVC(CZO*4SDiv,4,TZX(Dm,P`iI\`%X ~D*XrtT3dACm# X*Bn:Zr XML #=f"b"a XML #=1,7#K"M}CDmfZZ}] bP#(Z"a XML #=1,db2-xdb:column "MP8(DP2XkfZ#)g{C m;fZ,TC XML #=tCVb1Ma5Xms#g{ 8(K} mTbDTs,2a5Xms# 334 pureXML 8O 9C db2-xdb:rowSet "M1,Xk8( db2-xdb:column "Mr db2-xdb:condition "M# db2-xdb:rowSet k db2-xdb:column 2,hvK*XrtT+Vb=DmMP#db2- xdb:rowSet k db2-xdb:condition DiO8(;vu~,Cu~XkI",byE\+C P/DNNPek=mP(1S}CCm,r_(} "MdSX}CC m)# >} 0fP>K=V9C db2-xdb:rowSet D=(,BfTb=V=(xP5w# %i*XrtT3dA,;vm T Z T B x " M D # = ? V , Y ( BOOKCONTENTS m t Z 8(D SQL #=,"Y(;fZ S*Xk “BOOKCONTENTS”%dD+V *X# 22 XML is fun... ... XML can be used with... ... Recommended tutorials... ... ZG,BOOKCONTENTS mPndDZ]gBy>: Z 13 B x"MD XML #=Vb 335 m 45. BOOKCONTENTS ISBN CHPTNUM CHPTTITLE CHPTCONTENT 1-11-111111-1 1 Introduction to XML XML is fun... 1-11-111111-1 2 XML and Databases X M L c a n b e used with... ... ... ... ... 1-11-111111-1 10 Further Reading Recommended tutori- als... `i*XrtT3dA,;vm g{ +V"M|,k db2-xdb:rowSet "MP8(D5`%dD S*X,G4(} "M+C*XrtT3dAm#TZT Bx"MD#=?V,Y( ALLBOOKS mtZ 8(D SQL #=# ALLBOOKS book textbook 336 pureXML 8O 22 XML is fun... XML can be used with... Recommended tutorials... 0-11-011111-0 Programming with XML 435 Programming 4 Before you being programming... Now that you have learned the basics... ... You can apply advanced techniques... Z>>}P,P=i*XrtT3dAm ALLBOOKS: v /book/@isbn"/book/@authorID M /book/title v /textbook/isbn"/textbook/primaryauthorID M /textbook/title b=i*XrtTG(}k;,DP/{F`X*4xVD# m 46. ALLBOOKS ISBN TITLE AUTHORID 1-11-111111-1 My First XML Book 22 0-11-011111-0 Programming with XML 435 db2-xdb:table Vb"M "M+`v XML *XrtT3dA,;v?jP;z2IT9CC" M48(_P SQL #=D?jm,C SQL #=;,Z y8(D1! SQL #=# Z 13 B x"MD XML #=Vb 337 tZImS= XML #=D5PDVb"M/,9C|4hv XML D 5*XMtTk DB2 y>m.dD3d#Vb}L9Cx"MD XML #=47(& CgN+ XML D5*XMtTVb= DB2 mP# "M`M (bG DS*X)D+VS*X {FUd http://www.ibm.com/xmlns/prod/db2/xdb1 P'a9 \'VD S*XgBy>,4U8(|G1Xkq-D3rxPP>: (I!)mD SQL #=# y>mD{F#19COv "M5r "M5TKm{xP^(s,|Z9Ix"MD#=D XML #=D5/DyP "MPXkG(;D# yP8(K`, 5D*XMtT9I;P#IZITT,; v 58(`v *X,yTITP`i3d k%vm`X*# 5k db2-xdb:column "MP8(DPDi OJm+%v XML D5PD`i*XrtT3dA,;vmDP# XkAY8(;v *X,"R?v *X Z9Ix"MD#=D XML #=D5/DyP "MP DS*XDV{Z]P,UqGPbeD,;aTdxPf6/#b )*XDZ]Xkq- SQL j6D44fr#4(g5;xVs!4;TZ(g54 5,+}ECw(g{#XkT|,XbV{“<”M“&”D SQL j6xP*e# j8E" ZBPNN;VivB,Xk9C "M: v Z+`vfzP3dA,;vmP1(f0%;;C76D3d(bm>Cm;P ;iP3d)^h9CK"M;+G,h*9C db2-xdb:rowSet "M) v 1CZfEyVb}]DmD#=k "M(eD SQL #=;,1# ;\8(y>m;K3d;'Vd{`MDm(}g`Mm"\am"Y1mr_e /i/m)#;\T DB2 for Linux, UNIX, and Windows }]4Ts8(GF#?0 ;JmK"M9CS} TB>}5wZ+`v;C763dA,;P1,gN9C "M4+` X*XMtTVi=;pT9I;P#WH,}wK!y^D)# ... 22 author22@anyemail.com XML is fun... ... XML can be used with... ... Recommended tutorials... ... Alexander Smith 0 ... Y(KVb3dDC>G+|,w_j60d`&gSJ~X7DPek=,;v AUTHORSCONTACT mP#k"b, *XM *X<|,w_j6M gSJ~X7#rK,h*+`v;C763dA,;vmP`,DP#yT,Xk 9C "M#BfGx"MD#=PD?VZ],K?VZ]5wgN9 C 49`v76k,;vm`X*# adminSchema user1 AUTHORSCONTACT bookRowSet authorRowSet Z 13 B x"MD XML #=Vb 339 "Mj6*k db2-xdb:name S*X3dD?jmD{F#Z>>}P, AUTHORSCONTACT G?jm#*K7# *XPDj6MgSJ~X7k *XPDG)Z]V*fE(4,?;P|,_-O`XD5),9CK *X49`Xn`%X*#d;>>}PD M *XG@ "D5e,+Z3)ivB,*3dD5e;G@"D,h*T|GxP_-Vt, bIT(}9CP/5V# k"b,AUTHORSCONTACT myZD SQL #=;G1! SQL #=,9CK *X48(bViv#C=D AUTHORSCONTACT mgm 1 Py >: m 47. AUTHORSCONTACT AUTHID EMAILADDR 22 author22@anyemail.com 0800 author800@email.com >>}5wgN(}P/T5xP_-Vi,Sx7#;a^bP+;`XD53d A,;m/PT#Z>>}P,/root/book/authorID k /root/author/@ID 3dA,;m/P T#,y,/root/book/email k /root/author/@email 3dA,;m/PT#k *X5}P;fZ /root/book/email *X,"R^ (9CP/,G4;\7( *XPDgSJ~G&Ck /root/book/authorID 9 G /root/author/@ID `X*(r_,1kb=_`X*)#rK,(}Z "MP9P/k%vm`X*,PzZZ_-OT;,P/xPxV# db2-xdb:column Vb"M db2-xdb:column "M8( XML *XrtTy3dADmP{# db2-xdb:column tZImS= XML #=D5PDVb"M/,9C|4hv XML D 5*XMtTk DB2 y>m.dD3d#Vb}L9Cx"MD XML #=47(& CgN+ XML D5*XMtTVb= DB2 mP# "M`M r DtT,r_ DS*X# gN8( (}BPNN;V=(48( db2-xdb:column(dP value m>P'"M5): v 340 pureXML 8O v v value value ... {FUd http://www.ibm.com/xmlns/prod/db2/xdb1 P'5 NN{OBPu~Dy>mP{: v 4(gDP{;xVs!4#TZ(gDP{45,9C " T(g{xP*e# }g,*8(I=v%JiIDP{“col one”,db2-xdb:column DhCgBy>: db2-xdb:column=""col one"" (k"b,b)u~GX(ZK"MDhs#) v ZK"MP;\8(BP}]`MDP:CREATE TABLE SQL od'VDyP}] `M,+C'(eDa9`M}b# j8E" db2-xdb:column "MGw* XML *XrtTywPDtTr_w* DS*X8(D,|+ XML *XrtT3dA?jmPDP{# 9CK"M1,9Xk8( db2-xdb:rowSet "M#|G2,hvCZf"K*XrtT DVb5DmMP# >} TB>}5wgN9C db2-xdb:column "M4+ *XZ]ek= BOOKCONTENTS mDPP#BfWHxvx"MD#=D?VZ]# Bfa)Ky3dD *X,;sGjIVbsC=D BOOKCONTENTS m# 22 XML is fun... ... XML can be used with... ... Recommended tutorials... m 48. BOOKCONTENTS ISBN CHPTNUM CHPTTITLE CHPTCONTENT 1-11-111111-1 1 Introduction to XML XML is fun... 1-11-111111-1 2 XML and Databases X M L c a n b e used with... ... ... ... ... 1-11-111111-1 10 Further Reading Recommended tutori- als... db2-xdb:locationPath Vb"M TZT+V==ywDr_w*I4Ci;?VywD XML *XrtT,db2- xdb:locationPath "My]dfz+d3dA;,Dm/PT#I4CiGT+V==yw D|{4S`M"|{#MiM|{tTi# db2-xdb:locationPath tZImS= XML #=D5PDVb"M/,9C|4hv XML D5*XMtTk DB2 y>m.dD3d#Vb}L9Cx"MD XML #=47( &CgN+ XML D5*XMtTVb= DB2 mP# "M`M r DtT,r_ DtT# gN8( (}BPNN;V=(48( db2-xdb:locationPath(dP value m>P'"M5): v v v 342 pureXML 8O value ... {FUd http://www.ibm.com/xmlns/prod/db2/xdb1 P'5 db2-xdb:locationPath D5Xk9CTBo(: location path := ’/’ (locationstep ’/’)* lastlocationstep locationstep := (prefix’:’)? name lastlocationstep := locationstep | ’@’ (prefix:)? name dP,name G*X{FrtT{,prefix G{FUd0:# "b: v ;C76P9CDyP{FUd0: *XmS{FUdyw44({FUd0:s (# v g{ prefix *U,G4O* name ;ZNN{FUdP#g{Z#=D5PywK 1!{FUd,"R locationstep PD{FtZC{FUd,G4Xkyw1!{ FUdD{FUd0:,"RXk9CK{FUd0:4^({F;Z db2- xdb:locationPath P,U0:";m>1!{FUd# j8E" db2-xdb:locationPath "MC4hvT+V==ywDr_w*BPNN;nD;?Vy wD*XrtTD3d: v |{#Mi v |{tTi v +V4S`Myw v r%`Mr4S`MD+V*XrtT TZ^(4CD*XrtTyw(4|,Z|{4S`M(e"|{#Mir|{t TiPD>Xyw)45,db2-xdb:locationPath "M;pwC# 1ZwVfzPP9C+V*XrtTyww*}C(}g )1, &C9C db2-xdb:locationPath#IZ^(1SZ}CP8("M,yT,XkZ`&+ V*XrtTywP8(G)"M#IZ`&D*XrtTywG+VD,yT,I TS XML #=PDm`;,OBDP}CC*XrtT#(#,&C9C db2- xdb:locationPath 4xVb);,OBDPD3d#TZ|{4S`M"|{#MiM| {tTi45,&CZ*XMtTD?v3dOBDPT|GDywmS"M,Tc xPVb#&C9C db2-xdb:locationPath "M48(?v locationPath D?j rowSet-column T#,;v db2-xdb:locationPath 5ITCZ;,D rowSet-column T# Z 13 B x"MD XML #=Vb 343 >} TB>}5wgNy]tTyZDOBD4+,;vtT3dA;,Dm#BfWH xvx"MD#=D?VZ]# BOOKCONTENTS CHPTTITLE k"b,;P;v{*“title”DtTyw,+Z;,DOBDPP=vTKtTD} C#dP;v}CZ *XP,m;v}CZ *XP#h*+“title” tT5y]OBDVb=;,DmP#Kx"MD#=8(:g{“title”5Gi{,G 4+dVb= BOOKS mP,g{|GBZ{,G4+dVb= BOOKCONTENTS m P# Bfa)Ky3dD *X,;sGjIVbsC=D BOOKS m# 22 XML is fun... ... 344 pureXML 8O XML can be used with... ... Recommended tutorials... ... m 49. BOOKS ISBN TITLE CONTENT NULL My First XML Book NULL m 50. BOOKCONTENTS ISBN CHPTNUM CHPTTITLE CHPTCONTENT NULL NULL Introduction to XML NULL NULL NULL XML and Databases NULL ... ... ... ... NULL NULL Further Reading NULL db2-xdb:expression Vb"M db2-xdb:expression "M8(;v(Fmo=,+QCmo=Da{ek=K*X3dA DmP# db2-xdb:expression tZImS= XML #=D5PDVb"M/,9C|4hv XML D5*XMtTk DB2 y>m.dD3d#Vb}L9Cx"MD XML #=47( &CgN+ XML D5*XMtTVb= DB2 mP# "M`M r DtT,r_ DI!S*X, vT|,P3dD"MP'# gN8( (}BPNN;V=(48( db2-xdb:expression(dP value m>P'"M5): v v v value value value ... {FUd http://www.ibm.com/xmlns/prod/db2/xdb1 Z 13 B x"MD XML #=Vb 345 P'5 db2-xdb:expression D5Xk9CTBo(,Ko(* SQL mo=D;vS/: expression := function (arglist) | constant | $DECOMP_CONTENT | $DECOMP_ELEMENTID | $DECOMP_DOCUMENTID | (scalar-fullselect) | expression operator expression | (expression) | special-register | CAST (expression AS data-type) | XMLCAST (expression AS data-type) | XML-function operator :=+|-|*|/|CONCAT arglist := expression | arglist, expression j8E" db2-xdb:expression "M9z\;8(;v(Fmo=,19C $DECOMP_CONTENT 1,+QCmo=&CZyVbD XML *XrtTDZ]#;s,+QTKmo=x Ps5yzzDa{ek=VbZd8(DPP# 1zk*ek#?5(}g*XD{F)r_D5P4|,DzI51,K"M2G #PC# Xk9CP'D SQL mo=48( db2-xdb:expression,ys5mo=D`MXk\; 2,7("RkekC51*9CD?jPD`Mf]#'VTB SQL mo=S/; ;'VBf4hvDNNd{ SQL mo=,G)mo=ZK"MOBDPDP*G4 (eD# function (arglist) ZCj? SQL /}r_C'(eDj? SQL /}#j?/}DTd?G@" Dj?5#j?/}5X%v5(I\*U)#PX|`E",kNDPX/ }DD5# constant V{.#?5r}V#}5(P1F*Vf5)#PX|`E",kNDPX #?DD5# $DECOMP_CONTENT D5P3dD XML *XrtTD5,K5Gy] db2-xdb:contentHandling " MhC9lD#PX|`E",kNDVbX|VD5# $DECOMP_ELEMENTID 53zID{}j6,|Z XML D5P(;Xj6K"MyhvD*Xrt T#PX|`E",kNDVbX|VD5# $DECOMP_DOCUMENTID xdbDecompXML f"}LD documentid dkN}P8(DV{.5,K5j 6*VbD XML D5#PX|`E",kNDVbX|VD5# (scalar-fullselect) (Z2(EPD+i/,|5X;P,CPI%vP5iI#g{C+i/4 5XP,G4mo=Da{*U5# expression operator expression TO\'V5PmP(eD=v\'Vmo=Yw}Da{#kNDPXmo =DD5TKbPXmo=KcDj8E"# 346 pureXML 8O (expression) (Z2(EPDmo=,|{OOf(eD\'Vmo=Pm# special-register \'V(CDfwD{F#KhC+s5*10~qwD(CDfw5#kN D(CDfwDD5TKbj{D\'V(CDfwPm# CAST (expression AS data-type) g{mo=;*U,G4+Cmo=D`M*;*8(D SQL }]`M#g{ Cmo=*U,G4a{Gy8( SQL }]`MDU5#+U5ek=PP 1,mo=Xk+U5D`M*;*f]DP`M(}g,TZ{}P,4P CAST (NULL AS INTEGER))# XMLCAST (expression AS data-type) g{mo=;*U,G4+Cmo=D`M*;*8(D}]`M#mo=r ?j}]`MXk* XML `M#g{Cmo=*U,G4?j`MXk* XML,xa{GUD XML 5# XML-function NN\'VD SQL/XML /}# >} TB>}5wgN9C db2-xdb:expression "M4+ XML D5PD5&CZC'(e D/}#;s,+ UDF 5XDa{ek=}]bP,x;GekD5>mPD5#B fWHxvx"MD#=D?VZ]# Y(P;vSU{}N}(KN}m>w_Dj6)DC'(eD/} AuthNumBooks, C/}5X53PCw_yxi.D\}# Bfa)y3dD *X# Ann Brown 1 $DECOMP_CONTENT + ; f ; * ID t T 5 } P D 5 “22”# IZ $DECOMP_CONTENT # Z 13 B x"MD XML #=Vb 347 m 51. AUTHORS AUTHID FIRSTNAME SURNAME ACTIVE NUMBOOKS NULL NULL NULL NULL 8 db2-xdb:condition Vb"M db2-xdb:condition "M8(;vu~,Cu~7(Gq+Pek=mP#IT+zcC u~DPek=mP(b!vZP/Dd{u~,g{P);;a+;zcCu~D Pek=mP# db2-xdb:condition tZImS= XML #=D5PDVb"M/,9C|4hv XML D5*XMtTk DB2 y>m.dD3d#Vb}L9Cx"MD XML #=47( &CgN+ XML D5*XMtTVb= DB2 mP# "M`M r DtT,r_ DI!S*X# ^[u~ytD"MGq|,P3d,P'"M5): v v v value value ... {FUd http://www.ibm.com/xmlns/prod/db2/xdb1 P'5 BP`MD SQL =J:y>=J"?/=J"BETWEEN"EXISTS"IN"IS VALIDATED"LIKE"NULL M XMLEXISTS#b)=J9XkI db2-xdb:expression "MM/rP{'VDmo=iI# j8E" db2-xdb:condition "M9z\;8(;)u~,ZVbZd,+y]b)u~+5ek =}]bP#K"M(}&CC'8(Du~4TPxP}K#ZVbZd,+Qz c8(u~DPek=}]bP,x;aek;zcu~DP# g{,;vP/D`v*XrtTywP8(K db2-xdb:condition "M,G4v1yP u~D_- AND s5* true 1EaekCP# 348 pureXML 8O db2-xdb:condition PDP{ IZ db2-xdb:condition I SQL =JiI,yTITZK"MP8(P{#g{f0P /D db2-xdb:condition "M|,4^(DP{,G4ZyPf0CP/D3dP}: k"b,4T 8(P3d,+u~}CKP“columnX”#ZTCu~xPs51, +QCu~PD“columnX”f;* PD5#bGr*, T“columnX”8(KP 3d,x ;PP3d#g{ XML D5|,: abc def G4,IZZu~PT D5“def”xPKs5,yTK}PDu~+s5* false# g{Zk*X Dyw`XD db2-xdb:condition P9CK $DECOMP_CONTENT(; vVbX|V,|TV{}]N=8(3dD*XrtTD5)x;GP{,G4+ 9C (x;G )D54Tu~xPs5# g{ XML D5|,: abc def G4,Z>}P,IZs519CK D5“abc”,yTu~+s5* true# 1z;ky]m;v;aek=}]bPD*XrtT54Vb51,bVu~&m ==(9CP{M $DECOMP_CONTENT)MG#PC# D54|,T3dD*XrtT8(Du~ g{T*XrtT8(Ku~,+ XML D54|,C*XrtT,ZbVivB,T ;a&CCu~#}g, 49 XML D54|, *X,2T;aTu~“colInt > 100”xPs5#I Z 4vV,yTT“colInt”xPu~s51+9C1!5 0#ZG,Cu~G w* 0 > 100 s5D,b+s5* false#rK,VbZd;aek`&DP# >} Z 13 B x"MD XML #=Vb 349 *X: Alexander Smith 1 +y] db2-xdb:condition 8(Du~,47(GqaZVbZd+K *XP D5ek=?jmP#Bfa)K=Viv# yPu~ *X`T&Dx"MD#=P,Bfb?VZ]8(v 1w_Dj6G 1 = 999 .d" M *X;*U"R *X5HZ 1 1,E&CTK*XxPVb: M *X;*U1,E&CVb *X: m.dD3d#Vb}L9Cx"MD XML #= 47(&CgN+ XML D5*XMtTVb= DB2 mP# "M`M DtT,r_&CZ4S`Mrr%`M*XywD DtT gN8( (}BPNN;V=(48( db2-xdb:contentHandling(dP value m>P'"M5): v v value ... {FUd http://www.ibm.com/xmlns/prod/db2/xdb1 P'5 BPdP;vxVs!4DjG: v text v stringValue v serializeSubtree j8E" db2-xdb:contentHandling "MGw* XML *XywDtT8(D,|8>ZVbZd *ek=VpI db2-xdb:rowSet M db2-xdb:column 8(DmMPPD5#db2- xdb:contentHandling D}vP'5G: text v ekDZ]:K*XPV{}](|( CDATA ?VDV{Z])D"C# v E}DZ]:K*XD"MM&m8n"CDATA ?V(g{(“”)T0K*XDsz(|(jGMZ])# Z 13 B x"MD XML #=Vb 351 stringValue v ekDZ]:K*XPDV{}](|( CDATA ?VDV{Z])kK* XszPDV{}]D"C(4D53r"C)# v E}DZ]:"M"&m8n"CDATA ?V(g{(“”) T0K*XDszDp”)# v E}DZ]:^# v "b:ekDrP/V{.I\k XML D5PD`&?V";j+`,, bI\GIBPrX}pD:XML #=P8(D1!5"5e)9"tT3 r"tTDUqf6/T0T CDATA ?VxPD&m# IZKhCzzDrP/V{.G XML 5e,yT&C} TB>}5wgN9C;,D db2-xdb:contentHandling "MhC4Z?jmPqC;, Da{#WHxvx"MD#=,|5wgN9C db2-xdb:contentHandling 4T *XmS"M#(x"MD#=;a);N,|+ db2-xdb:contentHandling hC *“text”#>ZPDsx>}9C,;vx"MD#=,xvvGhCD db2- xdb:contentHandling 5Py;,#) 352 pureXML 8O Bfa)y3dD *X# 22 XML is lots of fun... XML can be used with... Escape characters such as , and & ]]>... ... Recommended tutorials... ... Bf}vmT>9C;,D db2-xdb:contentHandling 5T,;v XML *XxPVby zzDa{# ":ZTBmD CHPTTITLE M CHPTCONTENT PP,5}Z}EP#b)}EZP P;fZ,boa)b)}ED?DvvG*K8>ekDV{.D_gMUq# Z 13 B x"MD XML #=Vb 353 db2-xdb:contentHandling=″text″ m 53. BOOKCONTENTS ISBN CHPTNUM CHPTTITLE CHPTCONTENT 1-11-111111-1 1 ″Introduction to XML″ ″XML is fun...″ 1-11-111111-1 2 ″XML and Data- bases″ ″XML can be used with...″ 1-11-111111-1 2 ″XML and Data- bases″ ″ Escape characters such as <, >, and & ...″ ... ... ... ... 1-11-111111-1 10 ″Further Reading″″Recommended tutorials...″ k"b,9C“text”hC1,4ekZ;BZ;NP *XDZ]#bGr*“text”h C+E}szPDNNZ]#mk"b,9C“text”hC1,E}KZ~BZ;NPD "MM&m8n##tK *XPV{}]"CPDUq# db2-xdb:contentHandling=″stringValue″ m 54. BOOKCONTENTS ISBN CHPTNUM CHPTTITLE CHPTCONTENT 1-11-111111-1 1 ″Introduction to XML″ ″XML is lots of fun...″ 1-11-111111-1 2 ″XML and Data- bases″ ″XML can be used with...″ 1-11-111111-1 2 ″XML and Data- bases″ ″ Escape characters such as <, >, and & ...″ ... ... ... ... 1-11-111111-1 10 ″Further Reading″″Recommended tutorials...″ KmkO;vm.dDxpGZ;PD CHPTCONTENT PPy;,#k"b,ekK V{.“lots of”,KV{.4T *XD sz#1 db2- xdb:contentHandling hC*“text”1,IZ“text”hCE}szDZ],yTE}KKV{ .#+G,“stringValue”hC|(szDZ]#k“text”hC`,,4ek"MM&m 8n,"#tKUq# db2-xdb:contentHandling=″serializeSubtree″ m 55. BOOKCONTENTS ISBN CHPTNUM CHPTTITLE CHPTCONTENT 1-11-111111-1 1 ″Introduction to XML″ ″XML is lots of fun...″ 354 pureXML 8O m 55. BOOKCONTENTS (x) ISBN CHPTNUM CHPTTITLE CHPTCONTENT 1-11-111111-1 2 ″XML and Data- bases″ ″XML can be used with...″ 1-11-111111-1 2 ″XML and Data- bases″ ″ Escape characters such as , and & ]]>...″ ... ... ... ... 1-11-111111-1 10 ″Further Reading″″Recommended tutorials...″ Kmk0=vmDxpG,ekK *XDszPDyPjG(|( Dp p}`,,#t K XML D5PDUq# db2-xdb:normalization Vb"M db2-xdb:normalization "M8(*ekrf; $DECOMP_CONTENT(k db2- xdb:expression dO9C1)D XML }]PDUqDf6/# db2-xdb:normalization tZImS= XML #=D5PDVb"M/,9C|4hv XML D5*XMtTk DB2 y>m.dD3d#Vb}L9Cx"MD XML #= 47(&CgN+ XML D5*XMtTVb= DB2 mP# "M`M r DtT,r_ DtT# gN8( (}BPNN;V=(48( db2-xdb:normalization(dP value m>P'"M5): v v v value ... {FUd http://www.ibm.com/xmlns/prod/db2/xdb1 P'5 BPdP;vxVs!4DjG: v canonical v original(1!5) Z 13 B x"MD XML #=Vb 355 v whitespaceStrip ":db2-xdb:normalization tTvT3) XML #=`Mk SQL V{`M.dD3d P'#kND“j8E"”;ZTKbTZ SQL V{P45ITf6/D\'V XML # =`MPm# j8E" + XML 5 e k = V { ` M ? j P ( CHAR" VARCHAR" LONG VARCHAR"CLOB"DBCLOB"GRAPHIC"VARGRAPHIC M LONG VARGRAPHIC) 1,I\h*TyekD}]xPf6/#IT9C db2-xdb:normalization "M48( ;,`MDf6/;P'5(xVs!4DhC)gBy>: canonical + XML 5ek=?jPPr_CZf;K db2-xdb:normalization "MyZ3 dPvVD $DECOMP_CONTENT .0,y]C5D XML #=`M+d* ;*f6q=# original Z XML bvwT*XZ]rtT5(!vZK3dGCZ XML *X9G XML tT)D-D XML #= `M# IZ db2-xdb:normalization "MvT3) XML #== SQL V{`MD3dP',r K,g{T;\'VD3d8(K"M,|Ma;vT# >} TB>}5wgN9C db2-xdb:normalization "M4XFUqf6/#WHxvx"M D#=# Bfa)Ky3dD *X(ZTB>}P,*KcZ5w,+5C"bDUq m>I“_”B._V{),;sGjIVbsC=D AUTHORS m# Ann __Brown_ 1 m 56. AUTHORS AUTHID FIRSTNAME SURNAME ACTIVE NUMBOOKS 22 Ann __Brown_ true NULL “whitespaceStrip”hC *XP}%0< M2?Uq#bGr*, *XD XML #=`M*V{.,db2- xdb:normalization ;JCZC`M# D S*X;(e*<{` M,<{`MDf6m>GVf5“true”r“false”# *XD“canonical”hC Uq)ek= AUTHID PP# db2-xdb:order Vb"M db2-xdb:order "M8(;,m.dDPek3r# Z 13 B x"MD XML #=Vb 357 db2-xdb:order tZImS= XML #=D5PDVb"M/,9C|4hv XML D 5*XMtTk DB2 y>m.dD3d#Vb}L9Cx"MD XML #=47(& CgN+ XML D5*XMtTVb= DB2 mP# "M`M DS*X gN8( (}TB=(48( db2-xdb:order(dP value m>P'"M5): value ... ... {FUd http://www.ibm.com/xmlns/prod/db2/xdb1 P'a9 BfG\'VD S*X: db2-xdb:rowSet 8(3dA?jy>mD XML *XrtT# j8E" db2-xdb:order "MCZ(etZx(P/DPDek3r(`TZtZm;vP/D P)#bJm+ XML }]ek=?jmP,d=={OTX5#=PDm(eDyP }Cj{TZ RS2 .0,G4aZtZP/ RS2 DyPP. 0ekx(P/ RS1 DyPP#I8(K*XD`v5}T(e`vek3rcNa 9#TZ4vVZNN*XPDP/,|GDPI4Nb3rek(`TZNNd{ P/DP)#xR?v *XDZ]XkGT=(eDP/,r4Td 4(NNT=P/ywDVPm# I(e`vP/ekcNa9,!\P/;\vVZ *XD;v5} P,xR;\ZC*XPvV;N# TZS*XP8(D(g SQL j645,Xk+}E(g{|(ZV{Z]P,"R ;XxP*e#+G,XkT SQL j6P9CD“&”M“<”V{xP*e# 358 pureXML 8O >} TB>}5wgN9C db2-xdb:order "M# CUSTOMER PURCHASE_ORDER ITEMS_MASTER PO_ITEMS K>}P8(Kek3rD=v;`;cNa9#Z;vcNa98( CUSTOMER P /rmDyPZ]Z* PURCHASE_ORDER U/DyPZ].0ek,xZ~vcN a98( ITEMS_MASTER P/DyPZ]Zr PO_ITEMS PekNNZ].0ek# "b,4(e=vcNa9.dD3r#}g,PURCHASE_ORDER P/rmDyPZ ]IZr ITEMS_MASTER PekNNZ].0r.sek# ^F 8(P/ek3rfZBP^F: v Z 32 ;53O,VbxPek3r*sDsMD5I\m.dD3d#Vb}L9Cx"MD XML #=47(& CgN+ XML D5*XMtTVb= DB2 mP# "M`M r DtT,r_ DtT# gN8( (}BPNN;V=(48( db2-xdb:truncate(dP value m>P'"M5): v v Z 13 B x"MD XML #=Vb 359 v value ... {FUd http://www.ibm.com/xmlns/prod/db2/xdb1 P'5 BPdP;vjG: v 0(HZ false;1!5) v 1(HZ true) v false(xVs!4;1!5) v true(xVs!4) j8E" ek=?jV{PPD XML 5I\sZPs!,ZbVivB,XkXOC5E\I &XxPVb#db2-xdb:truncate tT8>15TZ?jP45+s1GqJmXOC 5#g{KtThC*“false”r“0”(m>;JmXO5),"RekD XML 5TZ? jP45+s,ZVb XML D5ZdMavm,"R;aekC5#“true”r“1”hC m>JmZekZdXO}]# db2-xdb:truncate vZ?jP{OBPu~1JC: v ?jP_PV{`M,r_ v ?jP_P DATE"TIME r TIMESTAMP `M,"R XML 5Vp_P xs:date"xs:time r xs:dateTime `M# g{Z db2-xdb:truncate yZD*XrtTywP8(K db2-xdb:expression "M,M avT db2-xdb:truncate 5,bGr*,g{+mo=(e*IT4PXO,Ma4P KnYw# Z+8(K1x"R XML #=`M*UZ"1dr1dAGD XML 5Vb= SQL UZ1dPP1,Xk+ db2-xdb:truncate hC*“true”r“1”#bGr* SQL UZ1d `MDa9;Jm8(1x# >} TB>}5wgNT *X&CXO&\#BfWHxvx"MD#=D?VZ ]# 360 pureXML 8O Bfa)y3dD *X# Alexander Smith 0 2001-10-31Z Y( FIRSTNAME P(e* CHAR SQL `M"Rs!* 7,"R ACTIVEDATE P (e* DATE SQL `M#Bfa)KjIVbsC=D AUTHORS m# m 57. AUTHORS AUTHID FIRSTNAME SURNAME ACTIVE ACTIVEDATE NUMBOOKS NULL Alexand NULL NULL 2001-10-31 NULL IZ 5“Alexander”D$HsZ SQL Ps!,yTh*4PXOE\ek C5#mk"b,IZ XML D5PD *X|,1x,yTQ+ db2- xdb:truncate hC*“true”T7#VbZd\;I&XekCUZ# IZh*4PXOE\ek *X5r *X5,yT,g{4 8( db2-xdb:truncate,MaIC db2-xdb:truncate D1!5(;Jm4PXO),"R +zImsT8>4ek5# db2-xdb:rowSetMapping Vb"M "M+%v XML *XrtT3dA;vr`vm/PT# tZImS= XML #=D5PDVb"M/,9C|4h v XML D5*XMtTk DB2 y>m.dD3d#Vb}L9Cx"MD XML # =47(&CgN+ XML D5*XMtTVb= DB2 mP# "M`M w* r DS*XD (bG D S*X)DS*X gN8( (}BPNN;V=(48( db2-xdb:rowSetMapping(dP value m>P'"M5): v value ... ... Z 13 B x"MD XML #=Vb 361 v value ... ... {FUd http://www.ibm.com/xmlns/prod/db2/xdb1 P'a9 \'VD tTgBy>: db2-xdb:contentHandling Jm8(+Vb=4S`M*XmD*XZ]# db2-xdb:locationPath Jm+w*I4Ci;?VywD XML *XrtT3dA;,Dm/PT(K 3dGy]C*XrtTDfzxPD)# db2-xdb:normalization Jm8(ekZ]0T3dAV{?jPD XML *XrtTZ]4PDf6 /P*# db2-xdb:truncate Jm8(Z+ XML 5ekV{?jP1GqJmxPXO# Db)tT2G XML *XrtTywDtT;^[|GG DtT9G r DtT,P*M hs S*XgBy>,4U8(|G1Xkq-D3r xPP>: + XML *XrtT3dA?jy>m# (I!)+ XML *XrtT3dAy>mP#g{ db2-xdb:rowSetMapping " M|, db2-xdb:expression,G4K*XGXhD# g{4F.rmek5,G4 GI!D,+;\CZu~& m#}g,g{*y]Z~v*XD54VbZ;v*X,G4IZ;aek Z~v*XD5,yTZ~v*X;h*P3d# (I!)8((Fmo=,+QCmo=Da{ek= db2-xdb:rowSet tT8 (DmP# 362 pureXML 8O g{ db2-xdb:expression 8(K $DECOMP_CONTENT,"RZ,;3dP8 (K db2-xdb:normalization,G4ZOJDivB,Z+ db2-xdb:expression D $DECOMP_CONTENT 5+]xCmo=TxPs5.0,+TC5xPf6 /# (I!)8(s5u~# k"b, Db)S*Xk|GD`&tT"M_P`,Doe Mo(,;G;h*T}ExP*e# *Kb|`j8E",kNDb)"MDtTf>D`&D5# j8E" IT9C 4+ XML *XrtT3dA%v?jmMP"3 dA,;vmD`v?jPr_3dA`vmMP#IT(}=VH,D=(43d A%vmMP:iO9C db2-xdb:rowSet M db2-xdb:column "M(|GGy3dD* XrtTDtT),r_8( (|Gy3dD*XrtTDS *X)#b=V=(\qC`,Da{,|GvvGm>(Py;,# Z DS*XDV{Z]P,yPUq} TB>}5wgN9C "M4+{*“isbn”D%vtT3d A`vm#BfWHxvx"MD#=D?VZ]#K?VZ]5wgN+ isbn 53d A BOOKS M BOOKCONTENTS m# BOOKS ISBN BOOKCONTENTS ISBN Bfa)Ky3dD *X,;sGjIVbsC=D BOOKS M BOOKCONTENTS m# Z 13 B x"MD XML #=Vb 363 22 XML is fun... ... ... m 58. BOOKS ISBN TITLE CONTENT 1-11-111111-1 NULL NULL m 59. BOOKCONTENTS ISBN CHPTNUM CHPTTITLE CHPTCONTENT 1-11-111111-1 NULL NULL NULL 9C "db2-xdb:rowSet 0 db2- xdb:column DiOD8C3d TBx"MD#=?VH,Z0fa)D XML #=,N,|Gzz`,DVba{# b=V#=.dDxpG,K#=+;v3df;* db2-xdb:rowSet k db2- xdb:column DiO,x;G;9C "M# BOOKCONTENTS ISBN db2-xdb:rowSetOperationOrder Vb"M db2-xdb:rowSetOperationOrder "MG;vr`v db2-xdb:order *XD8z#kNDP X db2-xdb:order D;ZTKbPX(e;,mdDPek3rDC(Dj8E"# db2-xdb:rowSetOperationOrder tZImS= XML #=D5PDVb"M/,9C|4 hv XML D5*XMtTk DB2 y>m.dD3d#Vb}L9Cx"MD XML #=47(&CgN+ XML D5*XMtTVb= DB2 mP# "M`M w*+V *XSzD DS*X# 364 pureXML 8O gN8( (}TB=(48( db2-xdb:rowSetOperationOrder(dP value m>P'"M5): value ... ... {FUd http://www.ibm.com/xmlns/prod/db2/xdb1 P'a9 BfG\'VD S*X: db2-xdb:order j8E" a+ *XiO=;p#S *XIfZ`v5},TJm(e`vekcNa9# (}JmXFek XML D5Z]D3r,db2-xdb:rowSetOperationOrder M db2- xdb:order "M;pa)K;V=(,T7# XML #=VbxLpXkT?jmDyP }Cj{T} kNDPX db2-xdb:order "MD;Z,Tq!8(P/ekD>}# x"MD XML #=VbDX|V x"MD XML #=Vba)KVbX|V4) db2-xdb:condition M db2- xdb:expression "M9C# $DECOMP_CONTENT D5P3dD XML *XrtTD5,K5Gy] db2-xdb:contentHandling " MhC9lD#&C}*Xr_|D*XZD53rPD;C#g {(}b)=(^DKD5,"RYNxPVb,*XDj6MI\kONV bsDj6;,#TtT8(D $DECOMP_ELEMENTID ;(eIKtTyt *XD $DECOMP_ELEMENTID 5# 2IT9C $DECOMP_ELEMENTID zID548>- "MDh C: – D> - vK*XPDV{}](;|,dsz) – V{.5 - K*XPDV{}]0dsz – serializedSubtree - K*XD* D5# v !vZ XML D5PQ3dDtTr*XDZ]D5 v @"Z XML D5PDNN5DQzI5 (} db2-xdb:expression "MITqCsf=V5#K"MJmz8(;vmo=,Z VbZd+ekCmo=Da{# IT+ XML D5PD5&CZmo=TzIa{,SxZ+}]ek=?jP.0d ;}]#mo=9ITzIyZQ3dD*XrtT5(}g,*XD{F)D5#db2- xdb:expression 9Jm8(#?,dP#?ITk XML D5PQ3dD5`X,2I T^X#db2-xdb:expression JmziOdPNb”)#XML bvw+T CDATA Z]xPPaxf6/&m# Z;P db2-xdb:contentHandling tTDivB,TZ*xPVbxmSK"MD*X4 5,+Q CDATA ?VDZ]ek=}]bP#4ek CDATA ?V(g{# g{9C db2-xdb:contentHandling=″serializeSubtree″ tTT XML #=PD XML *X ywmSK"M,G4ZVb4bvD XML D51+ek CDATA ?V(|( CDATA (g{)# 4bvD XML kQbvD XML ZVba{ODnp 19C db2-xdb:contentHandling=″serializeSubtree″ tTT`&D*XywmSK"M1, Vb CDATA ?V+fZnp#Vba{!vZdk XML D5G4bvD XML 9 GQbvD XML#}g,XML D5w*4bvD XML f"Z CLOB P,xw*Q bvD XML f"Z XML PP# Z 13 B x"MD XML #=Vb 367 g{dk XML D54TZG XML `MP,G4Vba{+#t*XPNN CDATA ?VD_gM- before cdata ]]> after cdata g { D 5 f"Z CLOB P P , G 4 Z*X a D 3 d P8( K db2- xdb:contentHandling=″serializeSubtree″ 1,VbYw+TQ3dA*X a DPzITB a{: before cdata ]]> after cdata g{ XML D5f"Z XML `MPP,G4K XML ,NDVba{*: before cdata in cdata & < > after cdata ;*CZVbDdkD54TZ XML `MP,M;a#t-4D CDATA ?V#! \;#t-4D CDATA ?Vk}7TJb^X(r*fz CDATA ?VZ_-OH [Z-4D CDATA ?V),+|I\akZ{Ddv;,# x"MD XML #=VbPDU5MUV{. x"MD XML #=Vb;PZ3)ivBEaekU5rUV{.# XML *X Bm5wKTZ XML D5PD*X,Z24ivBa+UV{.rU5ek=}]b P# m 60. y3d*XDU5&m== u~ UV{. U5 *X4|,ZD5P X *XzcBP+?u~: v |,ZD5P v Z start jGP|, xsi:nil="true" r xsi:nil="1" tT X *XzcBP+?u~: v |,ZD5P,"RGUD v Z start jGP4|, xsi:nil="true" r xsi:nil="1" tT v IzTr_;yw*_PPm`M"*O `M"xPlOZ]D4S`Mr_BP - S Z C ` M : xsd:string, xsd:normalizedString, xsd:token, xsd:hexBinary, xsd:base64Binary, xsd:anyURI, xsd:anySimpleType;NNd{`M<+< Bms# X ": 1. g{3v3df0 db2-xdb:condition r db2-xdb:expression "M,G4++]UV{.rU 5w*N}4xPmo=s5# 2. g{?jP`M* CHAR r GRAPHIC,G4+ekUV{.4w*UWV{DV{.# 368 pureXML 8O XML tT Bm5wK1D5PmSKVb"MD XML tT|,U5r_CD54|,CtT 1,Z24ivBa+UV{.rU5ek=}]bP# m 61. y3dtTDU5&m== u~ UV{. U5 tT4|,ZD5P(IZ44Pi$,r_ IZi$Yw4a)1!5) X tTzcBP+?u~: v |,ZD5P,"RGUD v IzTr_;yw*_PPm`M"*O `Mr_BP-SZC`M:xsd:string, xsd:normalizedString, xsd:token, xsd:hexBinary, xsd:base64Binary, xsd:anyURI, xsd:anySimpleType;;NNd{`M<+< Bms# X ":g{3v3df0 db2-xdb:condition r db2-xdb:expression "M,G4++]UV{.r U5w*N}4xPmo=s5# CZx"MD XML #=VbDKTm x"MD XML #=VbadC\4S#*K9Nq|C\m,&"b;)Bn# x"MD XML #=VbI\*sz+`v XML *XMtT3dA}]bP`vPM m#K3d9I\f0Zek XML }]0TdxPd;r_&Ceku~# TBGT XML #=mS"M1*`MPD+2*XMt T#rK,9XkZIz`MP|(y>`MPDVb"M# Z 13 B x"MD XML #=Vb 369 (})9Iz Z(})9IzD4S`MD(eP,v8(4|(Zy>`MPD*XMtT#g {Iz`MDVb3dky>`MD3d;,,G4XkTy>`MmSVb"MT w7X+y>`MD3dkIz`MD3dxV*# TB>}5wgN+(})9IzD`M outOfPrintBookType 3dAkdy>`M bookType ;,Dm#k"b,Z bookType y>`MP8(K db2-xdb:locationPath " M,Tw7XxVJCZy>`MD3dT0JCZIz`MD3d#Z>>}P, IZIz`M outOfPrintType D M *Xvf0Z%v3 dP,yTb)*X;h* db2-xdb:locationPath "M# BOOKS inPrintRowSet OUTOFPRINT outOfPrintRowSet outOfPrintRowSet TITLE outOfPrintRowSet ISBN 370 pureXML 8O outOfPrintBook CONTENT b ) " M 8 > + Q * X P D 5 V b = BOOKS m P , " R + Q *XPD5Vb= OUTOFPRINT mP# 22 XML is fun... XML can be used with... 41 Early XML... XML is an emerging technology... 2000-01-31 Early Publishers Group Z 13 B x"MD XML #=Vb 371 9COvx"MD#=VbK*XytDD5+zzBPwm: m 62. BOOKS ISBN TITLE CONTENT 1-11-111111-1 My First XML Book XML is fun... 1-11-111111-1 My First XML Book XML can be used with... m 63. OUTOFPRINT ISBN TITLE CONTENT LASTPUBDATE PUBLISHER 7-77-777777-7 Early XML Book Early XML... 2000-01-31 Early Publishers Group 7-77-777777-7 Early XML Book XML is an emerg- ing technology... 2000-01-31 Early Publishers Group Vb&\D XML #=9l(i (}w{x"MD XML #=PD*X3r,IT+x"MD#=VbT53ZfJ4 Dhs5AnM# TZG#sDD545,q-K(iI\9C;XvS DB2 }]b~qwDICZf ?,4IVbD5#TZ*xPVbxmSK"MD,z*X45,&C+r%`M D*XEZx"MD#=P,z4S`M*X0f#,y,&C+ maxOccurs tThC * 1 D,z*XEZ maxOccurs > 1 D,z*X0f# Z&mj9I;PDyPn.0,Xk+?v9ICPDn}5wKy3d,z*XD(i XML #=9lkGnE9l.dDTH#k" b,ZGnE>}P,4S`MD EZr%`MD 0f#( }+ EZ M *Xsf,ITa_VbKP1'J# <-- Recommended structuring with simple types placed before the recurring element , which is of complex type --> <-- Less optimal structuring with recurring complex type element appearing before the simple type element --> <-- 372 pureXML 8O --> k"b,"" M 3dA,;vP/,2MG5,|G2 ,9I;P#;PjIs,MaMEkCP`X*DZf#ZOfxvDGnEiv B,Z=oD5PD *X.0,;\+NNkP/ relA `X*DPS*Qj I#+G,IZ *XZ *X.0vV,yTXkWH&m *X#bb6E,Z=o *X.0(r_,g{D54|, , G4Z=o )2.0),Xk+ DyP5}<:fZZfP# g{3v*XPs?D5},G4bVa9D0lXs#}g,g{ *XP 10 000 v5},G4ZP/jI0,Xk+b 10 000 v5} 1,ITMEkP/ relA DP`X*DZf# x"MD XML #=VbPD3d>} x"MD XML #=Vb@?3d7(+ XML D5Vb*mD==#3dm>I"M DN=mS= XML #=D5P#b)3dhv*+ XML D5Vb*mD==#BP >}T>;)#{D3d=8# #{3d=8: x"MD XML #=VbPDP/ db2-xdb:rowSet j6+5Vb=dPD?jm#IT+K"MhC*m{rP/{# P/G9C db2-xdb:rowSet "M8(D,|+w**XrtTywDtTr "MDS"MmS= XML #=D5# iI XML #=DyP#=D5PT*XrtTD5}_P`, db2-xdb:rowSet 5D ;i3d(e;P# }g, 0-11-011111-0 Mary Brown Alex Page 2002 University of London 5-55-555555-5 Bob Carter Z 13 B x"MD XML #=Vb 373 Melaine Snowe 1999 *VbKD5,Tc?>iD ISBN Mjb(^[GN>9Gy/i)` XD5,xm;vP/CZViky/i`XD5# ZbVivB,P/7#;PG)oe`XD5EViZ;pNI;P#2MG5, 9CP/+(}N>DjbTN>D ISBN 5xPVi,"(}y/iDjbTy/i D ISBN xPVi#b7#;PP+;|,N>D ISBN 5,+_Py/iDjb# g{;PP/,G4^(7(D)5&CViZ;pTNIoeT}7DP# SB45wP/Z XML #=D5PD&C#VpZ M * XD ISBN *XywP8(K=vP/ textbk_rowSet M childrens_rowSet#;s,+ b)P/(} "Mk ALLPUBLICATIONS mX*# k"b,;*+P/"MCwmj6,xGCwP/j6,byzIT\]W|DZ XML #=P}CDm{#bGr*1 db2-xdb:rowSet D5m>j6x;Gm{1,h *9C "M4f}8 (m{#hzK=(,z;h*ZX*1|B;v;CDm{# admin ALLPUBLICATIONS textbk_rowSet childrens_rowSet 374 pureXML 8O BfT>K(}9CKx"MD XML #=xPVbzzDm# m 64. ALLPUBLICATIONS ISBN PUBS_TITLE 0-11-011111-0 Programming with XML 5-55-555555-5 Children’s Fables d;0fD>}5wK9CP/xPVbDr%iv,+ITZ|4SD3dP9C P/4+ XML #=D;,?VPD`vnViZ;p,TNImMPT`,DP# u~d; P/Jmzy]};VbD5>mTb)5&C;,Dd;# }g,49 49 g{b)*XD5+ek=,;vmP,"Rzk*Cm|,;BD5(}g,+? * Celsius 5),G4Zek.0,h*+_PtT unit=″Fahrenheit″ D5*;* Cel- sius#IT(}+tT* unit=″Celsius″ DyP*X3dA;vP/,"+tT* unit=″Fahrenheit″ DyP*X3dAm;vP/45VKYw#;s,ITZek.0T Fahrenheit 5DP/&C*;+=# "b,“unit”DtTywD3d;|,NN db2-xdb:column f6#bb6ECnD5v CZu~s5,x;aCZf"= db2-xdb:rowSet f68(DmP# I9CTB XML #=D5+ Celsius MQ*;D Fahrenheit 5ek=,;vmP: .... TEMPERATURE_DATA temp_celsius temp_fahrenheit ... temp_celsius col1 temp_fahrenheit col1 myudf_convertTocelsius($DECOMP_CONTENT) Z 13 B x"MD XML #=Vb 375 temp_celsius $DECOMP_CONTENT = ’Celsius’ temp_fahrenheit $DECOMP_CONTENT = ’fahrenheit’ Vb"M>}:3dA XML P Zx"MD XML #=VbP,IT+ XML ,N3dA9C XML }]#M(eD P# 0-11-011111-0 Mary Brown Alex Page 2002 University of London g{k*4gBy>f" XML *X Mi{,G4h*Z`& XML #= D5PT *XM title tTDywmS"M#b)"M&8( DETAILS M TITLE P(dP DETAILS PQ(e* XML `M)T0 TEXTBOOKS m# m 65. TEXTBOOKS TITLE DETAILS Programming with XML 0-11-011111-0 Mary Brown Alex Page 2002 University of London 376 pureXML 8O ITy]"MZ#=D5P+"M8(*tTr*X#3)"MIT8(*Nb; V#kND?v_e"MDD5T7(ITgN8(X("M# (}+ db2-xdb:rowSet M db2-xdb:column Cw r DtT r_9C D M S*X 48(?jmMP#+b)3d8(**XrtT<;y# TB XML #=D5,N5wKgN(}+"M8(*tT4+=v3dmSA *XM title tT# db2-xdb:rowSet "M8(?jmD{F,x db2-xdb:column "M8(?jPD{F#r * * X G 4 S ` M " R | , 4 S Z ] , x R ; P 8 ( db2- xdb:contentHandling "M,yTZ1!ivB,+4U db2-xdb:contentHandling D serializeSubtree hCQC*XPDyPjG(|(|D*}:;v53dA%vmazz%vP + XML D5PD;v53dA%vmMPTGx"MD XML #=VbP;Vr%N =D3d#K>}T>P/PD5.dOr%D;T;X5Div# K3dDa{!vZ3dA,;P/Dn.dDX5#g{;p3dA%vP/PD 5_P;T;X5,}g*XD maxOccurs tTD5r|,D#Miywy7(DG y,+T XML D5P3dDnD?v5}NI%vP#g{%vP/PD5_P;T `X5(4,;v5TZm;vnD`v5}ZD5PvvV;N),}g maxOccurs tTD5y8>DGy,G4Vb XML D51+zz`vP# 0-11-011111-0 Mary Brown Alex Page 2002 University of London Z 13 B x"MD XML #=Vb 377 g{k* M *XD5T0 title tTVb*gBy>D TEXT- BOOKS m,G4h*Z`& XML #=D5Pb)*XMtTDywPmS"M#" M+8(?vn3dADm{MP{# m 66. TEXTBOOKS ISBN TITLE DATE 0-11-011111-0 Programming with XML 2002 ITy]"MZ#=D5P+"M8(*tTr*X#3)"MIT8(*Nb; V#kND?v_e"MDD5T7(ITgN8(X("M# TZ+;v53dA%vmMPTDiv,h*T3dD58(mMP#bG9C db2- xdb:rowSet M db2-xdb:column w* r DtTr9C D M S*XjID#+b )3d8(**XrtT<;y# TB>}5wgN(}+"M8(*tT4Q *XPD*XMtT3dA TEXTBOOKS m# XML #=tT maxOccurs D1!5* 1,rK,3dA TEXTBOOKS P/D?vn KK.d_P;T;X5#r*bV;T;X5,yTa* *XD?v5} NI%vP# Vb"M>}:;v53dA%vmazz`vP + XML D5PD;v53dA%vmMPTGx"MD XML #=VbP;Vr%N =D3d#K>}T>P/PD5.dO4SD;T`X5Div# K3dDa{!vZ3dA,;P/Dn.dDX5#g{;p3dA%vP/PD 5_P;T;X5,}g*XD maxOccurs tTD5r|,D#Miywy7(DG y,+T XML D5P3dDnD?v5}NI%vP#g{%vP/PD5_P;T `X5(4,;v5TZm;vnD`v5}ZD5PvvV;N),}g maxOccurs tTD5y8>DGy,G4Vb XML D51+zz`vP# 0-11-011111-0 Mary Brown Alex Page 2002 University of London g{k*4gBy>f"N>D ISBN Mw_,G4*Z`&D XML #=D5PT M *XDywmS"M#"M&8( ISBN M AUTHNAME PT0 TEXTBOOK_AUTH m# m 67. TEXTBOOKS_AUTH ISBN AUTHNAME 0-11-011111-0 Mary Brown 0-11-011111-0 Alex Page ITy]"MZ#=D5P+"M8(*tTr*X#3)"MIT8(*Nb; V#kND?v_e"MDD5T7(ITgN8(X("M# TZ+;v53dA%vmMPTDiv,h*T3dD58(mMP#bG9C db2- xdb:rowSet M db2-xdb:column w* r DtTr9C D M S*XjID# +b)3d8(**XrtT<;y#ZBfvVD XML #=D5P+3d8(** X# TEXTBOOKS_AUTH ISBN TEXTBOOKS_AUTH AUTHNAME Z 13 B x"MD XML #=Vb 379 k"b,*24 *X;3dA ISBN P;N,4vVZmD=PPX?bGZ Vb}LPT/"zD,r*?v ISBN 5P`vw_# D5Z?vw_T&D ?;PPX4# vVbVivGr*Z M *X.dlb=;T`X5,r* D maxOccurs tTsZ 1# k"b,;T`X5ITf0=vTODn,"|(`in#;T`X59ITnn 6W,dPZ;v;T`X5PQf0DnITNkm;v;T`X5# Vb"M>}:;v53dA`vm IT+ XML D5PD%v53dA`vm#K>}5wgN"M XML #=D5T+ ;v53dA=vm# 0-11-011111-0 Mary Brown Alex Page 2002 University of London *+N>D ISBN 3dABP=vm,h*T *X4(=v3d#bIT(} Z XML #=D5P+`v *XmSA *Xyw4 5V# m 68. TEXTBOOKS ISBN TITLE 0-11-011111-0 Programming with XML m 69. SCHOOLPUBS ISBN SCHOOL 0-11-011111-0 University of London TB XML #=D5,N5wgN+=v3dmSA *Xyw48(A=vm D3d#title tTM *XD52|(Zb)3dP# TEXTBOOKS ISBN SCHOOLPUBS ISBN 380 pureXML 8O SCHOOLPUBS SCHOOL TEXTBOOKS TITLE `NvVD4S`M g{ XML #=PD`v;C}C;V4S`M,G4ITy]C`MZ#=PD;C 9C db2-xdb:locationPath "M+|3dA;,DmMP# ZbVivB,h*9C`v "M(?v3d;v"M)4 *C4S`M*XrtTywmS"M,dP?v3dI db2-xdb:locationPath tTx V# Vb"M>}:+3dA%vmD`v5xPVi Zx"MD XML #=VbP,IT+;`XD*XPD`v53dA,;vm,,1 #V_-`XD5.dDX5#(}yw`vCZVi`XnTNI;PDP/,I T5VC?D,gTB>}Py># }g, 0-11-011111-0 Mary Brown Alex Page 2002 University of London 5-55-555555-5 Bob Carter Melaine Snowe 1999 *ZVbszIBm,h*7#kN>`XD5Mky/iX*D5;Vi=,;P P # 9 C ` v P / 4 V i ` X D 5 " z I Z _ - O P beD P # Z 13 B x"MD XML #=Vb 381 m 70. ALLPUBLICATIONS PUBS_ISBN PUBS_TITLE 0-11-011111-0 Programming with XML 5-55-555555-5 Children’s Fables Z+%v53dA%vmMPTDr%3d=8P,IT;8(*+53dADmM P# ;x,K>}T>Div|S4S,|+`v53dA,;vm,RXkTb)5x P_-Vi#g{z;G*+?v ISBN Mjb3dA PUBS_ISBN M PUBS_TITLE P,xR;9CP/,G4Vb}L+^(7(Dv ISBN 5tZDvjb5#(}9 CP/,IT+_-`XD5xPViTNI;vPbeDP# TB XML #=D55wgN(e=vP/4xV *XD5k *XD5# ALLPUBLICATIONS textbk_rowSet childrens_rowSet 382 pureXML 8O k"b,db2-xdb:rowSet Z?v*XMtTywPD3d==;8(m{,xG8(P /{#+P/k "MPD ALLPUBLICATIONS mX*,C"MXk 8(* DS*X# (}8(3dA,;vmD`vP/,IT7#_-`XD5ZmPNI;P# Vb"M>}:+;,OBDPD`v53dA%vm Zx"MD XML #=VbP,IT+`v53dA,;vmMP,Tc%vPPIT |,4TD5;,?VD5#bIT(}yw`vP/45V,gTB>}Py># }g, 1-11-111111-1 Alice Braun Math Pubs 2002 University of London IT+w_Mvfg3dA,;v|,X(iD*5KDm# m 71. BOOKCONTACTS ISBN CONTACT 1-11-111111-1 Alice Braun 1-11-111111-1 Math Pubs zIDmP CONTACT PD54T XML D5D;,?V:;PI\|,w_DU{ (4T *X),xm;vP|,vfgD{F(4T *X)# TB XML #=D55wgN9C`vP/4zIKm# BOOKCONTACTS author_rowSet publisher_rowSet author_rowSet ISBN Z 13 B x"MD XML #=Vb 383 publisher_rowSet ISBN author_rowSet CONTACT publisher_rowSet CONTACT k"b,db2-xdb:rowSet Z?v*XywPD3d==;8(m{,xG8(P/D{ F#+P/k "MPD BOOKCONTACTS mX*,C"MXk8( * DS*X# 384 pureXML 8O x"MD#=VbD XML #== SQL `Mf]T x"MD XML #=Vb9z\;+ XML 5f"ZmPP#XML 5;\Vb*f] SQL P#BmP>D) XML #=`MkD) SQL P`M`f]# m 72. f]D XML #=M SQL }]`M XML #=`M S Q L S M A L L I N T S Q L I N T E G E R S Q L B I G I N T S Q L R E A L S Q L D E C I M A L S Q L D O U B L E S Q L D E C F L O A T ( 1 6 ) S Q L D E C F L O A T ( 3 4 ) S Q L D A T E S Q L T I M E S Q L T I M E S T A M P S Q L C H A R S Q L V A R C H A R S Q L L O N G V A R C H A R S Q L C L O B S Q L G R A P H I C S Q L V A R G R A P H I C S Q L L O N G V A R G R A P H I C S Q L D B C L O B S Q L C H A R F B D† S Q L B L O B S Q L V A R C H A R F B D† S Q L L O N G V A R C H A R F B D† string"normalizedString M token 1111111123465556a5a5a5a7a777 base64Binary M hexBinary -----------8a888----8c8b8b8b byte M unsigned byte 0a 0a 0a 0a 0a 0a 0a 0a - - - 9a* 9* 9* 9* -------- integer"positiveInteger" negativeInteger" nonNegativeInteger M nonPositiveInteger 1010101111111010---9a*9*9*9*-------- int 100a0a11110a0a0a---9a*9*9*9*-------- unsignedInt 10 10 0a 11 11 0a 0a 0a - - - 9a* 9* 9* 9* -------- long 10 10 0a 11 11 11 10 0a - - - 9a* 9* 9* 9* -------- unsignedLong 10 10 10 11 11 11 10 0a - - - 9a* 9* 9* 9* -------- short 0a 0a 0a 0a 0a 0a 0a 0a - - - 9a* 9* 9* 9* -------- unsignedShort 10 0a 0a 0a 0a 0a 0a 0a - - - 9a* 9* 9* 9* -------- decimal 21 21 21 11 11 11 11 11 - - - 9a* 9* 9* 9* -------- float 22 22 22 17 16 17 0a 0a - - - 9a* 9* 9* 9* -------- double 22 22 22 16 16 17 11 11 - - - 9a* 9* 9* 9* -------- boolean 12 12 12 12 12 12 12 12 - - - 9a* 9* 9* 9* -------- time ---------14-13a* 13* 13* 13* -------- dateTime --------15151913a* 13* 13* 13* -------- duration, gMonth, gYear, gDay, gMonthDay, gYearMonth -----------13a131313-------- date --------20--13a* 13* 13* 13* -------- Name, NCName, NOTATION, ID, IDREF, QName, NMTOKEN, ENTITY -----------65556a5a5a5a7a777 ENTITIES, NMTOKENS, IDREFS MPm`M -----------6b5b5b5b6c5c5c5c7c7b7b7b anyURI -----------18a181818----7a777 language -----------6555----7a777 anySimpleType M*O`M -----------6d5d5d5d6e5e5e5e7e7d7d7d anyType -----------6d5d5d5d6e5e5e5e7e7d7d7d <" † FOR BIT DATA Z 13 B x"MD XML #=Vb 385 * db2-xdb:normalization "MCZ7(ek=}]bPDV{.Dq=# - }]`Mkx"MD XML #=Vb;f]# 0 }]`MGf]D# 0a f]#"R,1 XML `MD5Ud|, -0 1,-0 Z}]bPf"* 0# 1 g{V{.ICDG?j SQL `MIS\DJcq=,"RIT*;*Z SQL `MD6'ZD}5,G4f]#+GI\a*'P'}V# 2 g{V{._PP'UZq=(yyyy-mm-dd"mm/dd/yyyy r dd.mm.yyyy),G 4f]# 3 g{V{._PP'1dq=(hh.mm.ss"hh:mm AM or PM r hh:mm:ss), G4f]# 4 g{V{._PP'1dAGq=(yyyy-mm-dd-hh.mm.ss.nnnnnn r yyyy- mm-dd hh.mm.ss.nnnnnn),G4f]# 5 g{ XML dkV{.$H(TVZF)!ZrHZ?jP$H(TVZF), G4f]#g{dkV{.H?jP$,G4v1TKP3d+ db2- xdb:truncate hC*“true”r“1”1,V{.Ef]#V{.$HGZf6/sF cD,dP,y] XML #=`MDUqf4TdkV{.xPf6/# 5a y] 5 PhvDu~7(Gqf]#Kb,dkV{.XkI+VZV{i I# 5b y] 5 PhvDu~7(Gqf]#Kb,ek=?jPPD5G"CDPm nV{.,wvPmn.dI%vUqVt(kPmD“[~”Uqf;B)# 5c y] 5a PhvDu~7(Gqf]#Kb,ek=?jPPD5G"CDPm nV{.,wvPmn.dI%vUqVt(kPmD“[~”Uqf;B)# 5d g{ XML dkV{.$H(TVZF)!ZrHZ?jP$H(TVZF), G4f]#g{dkV{.H?jP$,G4v1TKP3d+ db2- xdb:truncate hC*“true”r“1”1,V{.Ef]#^[D;Viv,ek=? jPPD5 false)r“1”(m> true)# 13 g{&mjIsy] db2-xdb:normalization hCFcD XML dkV{.$H ! Z r H Z ? j P $ H , G 4 f ] # x R , g { T K P 3 d + db2- xdb:truncate hC*“true”r“1”,2f]# 13a y] 13 PhvDu~7(Gqf]#Kb,g{dk XML V{.D$H! Z?jPD(e$H,G4ekCV{.1+ZR_ndUW# 14 TZ|,GkD XML 545,v1Vb"M8(K5*“true”r“1”D db2- xdb:truncate 1Ef]#TZxP1x8>{D XML 545,g{ db2- xdb:truncate hC*“true”r“1”,G4f];+ek;x1xD5# 15 g{j]* 4 ;"R0f;P“-”{E,G4f]#g{ XML 5;x1x8> {,G4f]#g{ XML 5xP1x8>{,G41 db2-xdb:truncate hC *“true”r“1”1,5Gf]D# 16 g{5Z SQL `MD6'Z,+;G“INF”"“-INF”r“NaN”,G4f]#1 XML `MD5Ud|, -0 1,-0 Z}]bPf"* 0#+GI\a*'P' }V# 17 g{5;G“INF”"“-INF”r“NaN”,G4f]#1 XML `MD5Ud|, -0 1,-0 Z}]bPf"* 0# 18 g{ URI DV{.$H(TVZF)!ZrHZ?jP$H(TVZF),G 4 f ] # g { d k V { . H ? j P $ , G 4 v 1 T K P 3 d + db2- xdb:truncate hC*“true”r“1”1,V{.Ef]#k"b,+ek URI >m (x;G URI 8rDJ4)# 18a y] 18 PhvDu~7(Gqf]#Kb,g{dk XML V{.D$H! Z?jPD(e$H,G4ekCV{.1+ZR_ndUW# 19 g{j]* 4 ;"R0f;P“-”{E,G4f]#TZxP1x8>{D XML 545,g{ db2-xdb:truncate hC*“true”r“1”,G4f]#(ZbVivB, +ek;x1xD5#)g{8(K,} 6 ;DGk,G41 db2- xdb:truncate hC*“true”r“1”1,5Gf]D# 20 g{j]* 4 ;"R0f;P“-”{E,G4f]#TZxP1x8>{D XML 545,g{ db2-xdb:truncate hC*“true”r“1”,G4f]#(ZbVivB, +ek;x1xDUZ5#) 21 }VD!}?V;XO#g{{}?VZ SQL `MD6'Z,G4f]#1 XML `MD5Ud|, -0 1,-0 Z}]bPf"* 0# 22 }VD!}?V;XO#g{{}?VZ SQL `MD6'Z,"R5;G “INF”"“-INF”r“NaN”,G4f]#1 XML `MD5Ud|, -0 1,-0 Z }]bPf"* 0# x"MD XML #=VbD^F x"MD XML #=VbfZX(^F# 388 pureXML 8O ^F m 73. x"MD XML #=VbD^F u~ ^F5 *VbDD5Dnss! 2GB %vx"MD XML #=P}CDnsm} 100 db2-xdb:expression " M P D n s $DECOMP_CONTENT r $DECOMP_ELEMENTID 5}} 10 db2-xdb:locationPath PDnsc} 100 r D“namespace”t TPT=P>Dns{FUd}(g{CPm |,Xb5 ##targetNamespace r ##local, G4^F2JCZb)Xb5) 25 db2-xdb:name(m{)"db2-xdb:column"db2- xdb:defaultSQLSchema r db2-xdb:SQLSchema 5DnsV{.$H k`& DB2 TsD^F`, db2-xdb:rowSet 5DnsV{.$H k db2-xdb:name D^F`, $DECOMP_CONTENT D5DnsV{.$H 4096 VZ ^F v x"MD XML #=Vb;'VBPwn: – Vb(d*XrtT:;Vb XML D5Pk XML #=PD r yw`T&D*XrtT# +G,g{b)*XrtTGZ+ db2-xdb:contentHandling hC* “serializeSubtree”r“stringValue”ivBVbD*XDSz,Ma+(d*Xrt TDZ]w*rP/SwrV{.5D;?VxPVb#+G,b)(d*Xr tTXkzc`& r ywP8(D{FUd can be changed to an equivalent named model group: IT+vVD *Xf;* XML D5PB(eD8(#Mi# Z 13 B x"MD XML #=Vb 389 – 9C xsi:type xPDKP1f;:*XGy]k#=P*X{F`X*D#=`M PD3d4VbD#g{(}9C xsi:type 4TD5PD*X8(m;`M,Ma }?jmPVPDP:Vb&\;'VekBP#(zTITZ XML V b}Lb?|Br>}P#) – S NOTATION IzDr%`MDtT:Vb&\vekm>({# – ENTITY `MDtT:Vb&\vek5e{# – 9C db2-xdb:expression M db2-xdb:condition `N3dA,;vP/MP:1` vny]3dfrO(X3dA,;vP/MP1,G)3d;\|, db2- xdb:expression r db2-xdb:condition "M# v ZVx}]b73P,_P"MD XML #=VbvZ|,}]b?*QtC#g{ XSR Ts4tC,G4D~r(zU>D~}#9IT9C logfilsiz dCN} 4vswU>D~M(zU>D~Ds!# x(M"PT g{ZVbD51v=x(}6r@x,G4I(}&CLrw{"PXF#g{& CLr,1wC`vNb xdbDecompXML f"}L,dP`vVbYwPf0m`` ,Dm,G4&CLrh*\mTb)mD"PCJ,T@9vVx(}6M@x# w{"PXFD;V=(G,ZwC xdbDecompXML f"}L.0T=x(VbPf 0DyPm#;s,ZCf"}L5XsDJ11d4P COMMIT r ROLLBACK o d#r*VbsMD5I\wbT>K XML Vb(eDx"M#=D XML #=# Z 13 B x"MD XML #=Vb 391 392 pureXML 8O Z 14 B T pureXML D^F T pureXML &\D^F pureXML &\fZ3)^F,|(T XML P(eD^F"+m,SAVxm1D^ FT0Vx}]b73PD^F# T XML P(eD^F XML PfZTB^F: v T XML P4(w}1,Xk9C GENERATE KEY USING XMLPATTERN Sd, "Rw};\GiOw}D;?V#IT XML P4(`vw}# v ;PZk VALIDATED =JdO9C1E\Z CHECK } XML P1,Xk>}%v ALTER TABLE odP DmDyP XML P# v TZ DB2 f> 9.7 ^)| 1 0|_"Pf,ITU/yZ XML }]Dw}(k T XML P(e)DV<3FE"#BP^FJCZkT XML PDU/V<3FE ": – +U/?vyZ XML }]Dw}(kT XML P8()DV<3FE"#*w } 8 ( D } ] ` M X k * VARCHAR"DOUBLE"INTEGER"DECIMAL"TIMESTAMP r DATE#;aU /yZ XML }]"`M* VARCHAR HASHED Dw}DV<3FE"# – ?vyZ XML }]Dw}DV<3FE"9Cns5 250 V;}w*1!5# "v RUNSTATS |n1,9C ON COLUMNS r DEFAULT SdPD NUM_QUANTILES N}8(5,4I|D1!5#U/ XML V<3FE"1,+avT num_quantiles }]bdCN}# – 9C STATISTICS !n0k}]1,;a4( XML V<3FE"# – ;aU/yZ XML }]DVxw}(kTVxm(e)D XML V<3FE"# © Copyright IBM Corp. 2006, 2013 393 T%"wD^F Z BEFORE r AFTER %"wD%"wweP,}C\0lPP`M* XML DPD *;d?;\k XMLVALIDATE /}dO9CxPi$,T+ XML P5hC* NULL,r#t XML P5;d# +Vx,SAVxm1D^F 9C ALTER ATTACH +Vx,S=xP XML PDVxm1,*,SDm(4m) O?v XML PD INLINE LENGTH Xkk,SADm(?jm)OT& XML PD INLINE LENGTH %d# g{m|,D XML P9Cf> 9.5 r.0f>D XML G 9.7 r|_f>G# 2. 9C TRUNCATE od4>}CmPDyPP"MEVdxCmDf"Ud# 3. 9C LOAD |n+C}]mS=mP# |BCmD XML G 9.5 r.0f>D XML G 9.5 r.0f>D XML GD~P4k;v{"# *9mD XML f"TsPD}]{O9uu~,k9C ADMIN_MOVE_TABLE f "}LT+Cm*;IBq=,;sTQ(FDmtC}]P9u# d{^F 9CrP/ XML }]:!\Ze5a9OTf"Z}]bPD XML 5Ds!;P^ F,+Gk}]b;;DrP/D XML }]5JO;^F* 2GB# 9C RUNSTATS |n:g{T XML }]D ALLOW READ ACCESS 0kYwQjI" R9m&Z/Oj{T]R4,,G4ITKm"v RUNSTATS |n#ZK=8P, RUNSTATS Yw4;=H0D0kYwP;ISD XML w}|"5Xms#d(=( GZKP RUNSTATS |n.0KP SET INTEGRITY od# 9C LOAD |n:9C LOAD |n0k XML }]1,ZBPivB;'V9C FOR EXCEPTION Sd48(0kl#m: v 9CyZj)DCJXF(LBAC)1# v +}]0k=VxmP1# T XML P4(w}:T XML P4(w}M9C XSLT y=mxPd;1,fZd {^F# 9CsZ 5000 D maxOccurs tT5:Z DB2 V9.7 FP1 M|_f>P,g{Z DB2 XSR P"aD XML #=9C maxOccurs tT"RCtTD5sZ 5000,G4a+ K maxOccurs tT5Swz8(K“unbounded”;y#r*a+d maxOccurs tT5s Z 5000 DD5*XSwz8(K“^^F”;y4&m,yT1z9C XMLVALIDATE /}1,XML D5I\a(}i$,494UzC4i$CD5D XML #=,3v *XDvVN},}Kns52GgK#PX|`E"M(iDd(=(,ki4 XMLVALIDATE /}E"# 9C RESTORE DATABASE |n:g{#=PDNNm|, XML P,G4;\9 C TRANSPORT !n4+dmUdM SQL #=# Z 14 B T pureXML D^F 395 396 pureXML 8O =< A. `k3d +`k{3dAQf"D XML }]DP' CCSID g{ XML PPf"D}]|,Z~xF&CLrd?P,r_C}]GZ?`kD XML `M,G4 DB2 }]b\mwMaliC}]T7(`k#g{C}]|,`k yw,}]b\mwMa+`k{F3dA CCSID# Z 298 3Dm 39 P>Kb)3d#g{`k{4|,ZZ 298 3Dm 39 P,}]b\ mwMa5Xms# Z 298 3Dm 39 Z;PPDf6/`k{G(}+`k{*;*s4"}%yP,V {"SE"B._"0E"dcMUqC=#}g,ISO88591 G ISO 8859-1"ISO- 8859-1 M iso-8859-1 Df6/`k{# m 74. `k{MP' CCSID f6/`k{ CCSID 437 437 646 367 813 813 819 819 850 850 852 852 855 855 857 857 862 862 863 863 866 866 869 869 885913 901 885915 923 88591 819 88592 912 88595 915 88597 813 88598 62210 88599 920 904 904 912 912 915 915 916 916 920 920 © Copyright IBM Corp. 2006, 2013 397 m 74. `k{MP' CCSID (x) f6/`k{ CCSID 923 923 ANSI1251 1251 ANSIX341968 367 ANSIX341986 367 ARABIC 1089 ASCII7 367 ASCII 367 ASMO708 1089 BIG5 950 CCSID00858 858 CCSID00924 924 CCSID01140 1140 CCSID01141 1141 CCSID01142 1142 CCSID01143 1143 CCSID01144 1144 CCSID01145 1145 CCSID01146 1146 CCSID01147 1147 CCSID01148 1148 CCSID01149 1149 CP00858 858 CP00924 924 CP01140 1140 CP01141 1141 CP01142 1142 CP01143 1143 CP01144 1144 CP01145 1145 CP01146 1146 CP01147 1147 CP01148 1148 CP01149 1149 CP037 37 CP1026 1026 CP1140 1140 CP1141 1141 CP1142 1142 CP1143 1143 CP1144 1144 398 pureXML 8O m 74. `k{MP' CCSID (x) f6/`k{ CCSID CP1145 1145 CP1146 1146 CP1147 1147 CP1148 1148 CP1149 1149 CP1250 1250 CP1251 1251 CP1252 1252 CP1253 1253 CP1254 1254 CP1255 1255 CP1256 1256 CP1257 1257 CP1258 1258 CP1363 1363 CP1383 1383 CP1386 1386 CP273 273 CP277 277 CP278 278 CP280 280 CP284 284 CP285 285 CP297 297 CP33722 954 CP33722C 954 CP367 367 CP420 420 CP423 423 CP424 424 CP437 437 CP500 500 CP5346 5346 CP5347 5347 CP5348 5348 CP5349 5349 CP5350 5350 CP5353 5353 CP813 813 CP819 819 =< A. `k3d 399 m 74. `k{MP' CCSID (x) f6/`k{ CCSID CP838 838 CP850 850 CP852 852 CP855 855 CP857 857 CP858 858 CP862 862 CP863 863 CP864 864 CP866 866 CP869 869 CP870 870 CP871 871 CP874 874 CP904 904 CP912 912 CP915 915 CP916 916 CP920 920 CP921 921 CP922 922 CP923 923 CP936 1386 CP943 943 CP943C 943 CP949 970 CP950 950 CP964 964 CP970 970 CPGR 869 CSASCII 367 CSBIG5 950 CSEBCDICCAFR 500 CSEBCDICDKNO 277 CSEBCDICES 284 CSEBCDICFISE 278 CSEBCDICFR 297 CSEBCDICIT 280 CSEBCDICPT 37 CSEBCDICUK 285 400 pureXML 8O m 74. `k{MP' CCSID (x) f6/`k{ CCSID CSEBCDICUS 37 CSEUCKR 970 CSEUCPKDFMTJAPANESE 954 CSGB2312 1383 CSHPROMAN8 1051 CSIBM037 37 CSIBM1026 1026 CSIBM273 273 CSIBM277 277 CSIBM278 278 CSIBM280 280 CSIBM284 284 CSIBM285 285 CSIBM297 297 CSIBM420 420 CSIBM423 423 CSIBM424 424 CSIBM500 500 CSIBM855 855 CSIBM857 857 CSIBM863 863 CSIBM864 864 CSIBM866 866 CSIBM869 869 CSIBM870 870 CSIBM871 871 CSIBM904 904 CSIBMEBCDICATDE 273 CSIBMTHAI 838 CSISO128T101G2 920 CSISO146SERBIAN 915 CSISO147MACEDONIAN 915 CSISO2INTLREFVERSION 367 CSISO646BASIC1983 367 CSISO88596I 1089 CSISO88598I 916 CSISOLATIN0 923 CSISOLATIN1 819 CSISOLATIN2 912 CSISOLATIN5 920 =< A. `k3d 401 m 74. `k{MP' CCSID (x) f6/`k{ CCSID CSISOLATIN9 923 CSISOLATINARABIC 1089 CSISOLATINCYRILLIC 915 CSISOLATINGREEK 813 CSISOLATINHEBREW 62210 CSKOI8R 878 CSKSC56011987 970 CSMACINTOSH 1275 CSMICROSOFTPUBLISHING 1004 CSPC850MULTILINGUAL 850 CSPC862LATINHEBREW 862 CSPC8CODEPAGE437 437 CSPCP852 852 CSSHIFTJIS 943 CSUCS4 1236 CSUNICODE11 1204 CSUNICODE 1204 CSUNICODEASCII 1204 CSUNICODELATIN1 1204 CSVISCII 1129 CSWINDOWS31J 943 CYRILLIC 915 DEFAULT 367 EBCDICATDE 273 EBCDICCAFR 500 EBCDICCPAR1 420 EBCDICCPBE 500 EBCDICCPCA 37 EBCDICCPCH 500 EBCDICCPDK 277 EBCDICCPES 284 EBCDICCPFI 278 EBCDICCPFR 297 EBCDICCPGB 285 EBCDICCPGR 423 EBCDICCPHE 424 EBCDICCPIS 871 EBCDICCPIT 280 EBCDICCPNL 37 EBCDICCPNO 277 402 pureXML 8O m 74. `k{MP' CCSID (x) f6/`k{ CCSID EBCDICCPROECE 870 EBCDICCPSE 278 EBCDICCPUS 37 EBCDICCPWT 37 EBCDICCPYU 870 EBCDICDE273EURO 1141 EBCDICDK277EURO 1142 EBCDICDKNO 277 EBCDICES284EURO 1145 EBCDICES 284 EBCDICFI278EURO 1143 EBCDICFISE 278 EBCDICFR297EURO 1147 EBCDICFR 297 EBCDICGB285EURO 1146 EBCDICINTERNATIONAL500EURO 1148 EBCDICIS871EURO 1149 EBCDICIT280EURO 1144 EBCDICIT 280 EBCDICLATIN9EURO 924 EBCDICNO277EURO 1142 EBCDICPT 37 EBCDICSE278EURO 1143 EBCDICUK 285 EBCDICUS37EURO 1140 EBCDICUS 37 ECMA114 1089 ECMA118 813 ELOT928 813 EUCCN 1383 EUCJP 954 EUCKR 970 EUCTW 964 EXTENDEDUNIXCODEPACKEDFORMATFORJAPANESE 954 GB18030 1392 GB2312 1383 GBK 1386 GREEK8 813 GREEK 813 HEBREW 62210 =< A. `k3d 403 m 74. `k{MP' CCSID (x) f6/`k{ CCSID HPROMAN8 1051 IBM00858 858 IBM00924 924 IBM01140 1140 IBM01141 1141 IBM01142 1142 IBM01143 1143 IBM01144 1144 IBM01145 1145 IBM01146 1146 IBM01147 1147 IBM01148 1148 IBM01149 1149 IBM01153 1153 IBM01155 1155 IBM01160 1160 IBM037 37 IBM1026 1026 IBM1043 1043 IBM1047 1047 IBM1252 1252 IBM273 273 IBM277 277 IBM278 278 IBM280 280 IBM284 284 IBM285 285 IBM297 297 IBM367 367 IBM420 420 IBM423 423 IBM424 424 IBM437 437 IBM500 500 IBM808 808 IBM813 813 IBM819 819 IBM850 850 IBM852 852 IBM855 855 404 pureXML 8O m 74. `k{MP' CCSID (x) f6/`k{ CCSID IBM857 857 IBM862 862 IBM863 863 IBM864 864 IBM866 866 IBM867 867 IBM869 869 IBM870 870 IBM871 871 IBM872 872 IBM902 902 IBM904 904 IBM912 912 IBM915 915 IBM916 916 IBM920 920 IBM921 921 IBM922 922 IBM923 923 IBMTHAI 838 IRV 367 ISO10646 1204 ISO10646UCS2 1200 ISO10646UCS4 1232 ISO10646UCSBASIC 1204 ISO10646UNICODELATIN1 1204 ISO646BASIC1983 367 ISO646IRV1983 367 ISO646IRV1991 367 ISO646US 367 ISO885911987 819 ISO885913 901 ISO885915 923 ISO885915FDIS 923 ISO88591 819 ISO885921987 912 ISO88592 912 ISO885951988 915 ISO88595 915 ISO885961987 1089 =< A. `k3d 405 m 74. `k{MP' CCSID (x) f6/`k{ CCSID ISO88596 1089 ISO88596I 1089 ISO885971987 813 ISO88597 813 ISO885981988 62210 ISO88598 62210 ISO88598I 916 ISO885991989 920 ISO88599 920 ISOIR100 819 ISOIR101 912 ISOIR126 813 ISOIR127 1089 ISOIR128 920 ISOIR138 62210 ISOIR144 915 ISOIR146 915 ISOIR147 915 ISOIR148 920 ISOIR149 970 ISOIR2 367 ISOIR6 367 JUSIB1003MAC 915 JUSIB1003SERB 915 KOI8 878 KOI8R 878 KOI8U 1168 KOREAN 970 KSC56011987 970 KSC56011989 970 KSC5601 970 L1 819 L2 912 L5 920 L9 923 LATIN0 923 LATIN1 819 LATIN2 912 LATIN5 920 LATIN9 923 406 pureXML 8O m 74. `k{MP' CCSID (x) f6/`k{ CCSID MAC 1275 MACEDONIAN 915 MACINTOSH 1275 MICROSOFTPUBLISHING 1004 MS1386 1386 MS932 943 MS936 1386 MS949 970 MSKANJI 943 PCMULTILINGUAL850EURO 858 R8 1051 REF 367 ROMAN8 1051 SERBIAN 915 SHIFTJIS 943 SJIS 943 SUNEUGREEK 813 T101G2 920 TIS20 874 TIS620 874 UNICODE11 1204 UNICODE11UTF8 1208 UNICODEBIGUNMARKED 1200 UNICODELITTLEUNMARKED 1202 US 367 USASCII 367 UTF16 1204 UTF16BE 1200 UTF16LE 1202 UTF32 1236 UTF32BE 1232 UTF32LE 1234 UTF8 1208 VISCII 1129 WINDOWS1250 1250 WINDOWS1251 1251 WINDOWS1252 1252 WINDOWS1253 1253 WINDOWS1254 1254 WINDOWS1255 1255 =< A. `k3d 407 m 74. `k{MP' CCSID (x) f6/`k{ CCSID WINDOWS1256 1256 WINDOWS1257 1257 WINDOWS1258 1258 WINDOWS28598 62210 WINDOWS31J 943 WINDOWS936 1386 XEUCTW 964 XMSWIN936 1386 XUTF16BE 1200 XUTF16LE 1202 XWINDOWS949 970 + CCSID 3dArP/ XML dv}]D`k{ w*~=rT= XMLSERIALIZE YwD;?V,DB2 }]b\mwI\aZrP/ XML dv}]*7mS`kyw# CywDq=gBy>: (#,`kywPDV{/j6hvdvV{.PDV{`k#}g,Z+ XML }] rP/*k?j&CLr}]`MT&D CCSID 1,`kyw+hv?j&CLrd ? CCSID#&CLr4P8(K INCLUDING XMLDECLARATION DT= XMLSERIALIZE /}1Div}b#g{8(K INCLUDING XMLDECLARATION, }]b\mwMa* UTF-8 zI`kyw#g{?j}]`MG CLOB r DBCLOB `M,MI\a4Pd{zk3*;Yw,ba} *?v?E9l?E*X,dP|,4UOErD01Pm# © Copyright IBM Corp. 2006, 2013 413 SELECT XMLSERIALIZE( CONTENT XMLELEMENT( NAME "Department", XMLATTRIBUTES( E.WORKDEPT AS "name" ), XMLAGG( XMLELEMENT( NAME "emp", E.LASTNAME ) ORDER BY E.LASTNAME ) ) AS CLOB(110) ) AS "dept_list" FROM EMPLOYEE E WHERE E.WORKDEPT IN (’C01’,’E21’) GROUP BY WORKDEPT Ki/+zITBa{: dept_list -----------------------... KWAN NICHOLLS QUINTANA GOUNOT LEE MEHTA SPENSER ":XMLAGG ;aZdvPekUqr;P{#yP>}dv<+q=/Tv?IA T# XMLATTRIBUTES XMLATTRIBUTES /}+(}Td?9l XML tT# XMLATTRIBUTES  , ( attribute-value-expression ) AS attribute-name #=* SYSIBM#;\+/}{8(*^({# K/};\Cw XMLELEMENT /}DTd?#a{G;v XML rP,TZ?vG Udk5,CrP<|,;v XQuery tTZc# attribute-value-expression a{*tT5Dmo=#attribute-value-expression D}]`M;\G XML `Mr a9/`M (SQLSTATE 42884)#Cmo=ITGNN SQL mo=#g{Cmo =;Gr%P}C,G4Xk8(tT{F# 414 pureXML 8O attribute-name 8(tT{F#C{FGXkT XML ^({Fr QName (SQLSTATE 42634) q =vVD SQL j6#PXP'{FD|`j8E",kND W3C XML {FUd f6#CtT{F;\G xmlns rT xmlns: *0:#{FUdG9C/} XMLNAMESPACES ywD#;\G~=9GT=,<;Jm9CX4DtT{F (SQLSTATE 42713)# g{48( attribute-name,G4 attribute-value-expression XkGP{ (SQLSTATE 42703)#tT{FGy]P{9CSP{A XML tT{FDj+*e3d4(D# a{D}]`M* XML#g{ attribute-value-expression I*U,G4a{I*U;g {?v attribute-value-expression *U,G4a{*U# >} ":XMLATTRIBUTES ;aZdvPekUqr;P{#yP>}dv<+q=/T v?IAT# v >} 1:+9CtTzI*X# SELECT E.EMPNO, XMLELEMENT( NAME "Emp", XMLATTRIBUTES( E.EMPNO, E.FIRSTNME ||’ ’|| E.LASTNAME AS "name" ) ) AS "Result" FROM EMPLOYEE E WHERE E.EDLEVEL = 12 Ki/+zITBa{: EMPNO Result 000290 000310 200310 v >} 2:9CNN QName P49CD{FUdyw4zI*X#+ZtT5P9C 0:# VALUES XMLELEMENT( NAME "size", XMLNAMESPACES( ’http://www.w3.org/2001/XMLSchema-instance’ AS "xsi", ’http://www.w3.org/2001/XMLSchema’ AS "xsd" ), XMLATTRIBUTES( ’xsd:string’ AS "xsi:type" ), ’1’ ) Ki/+zITBa{: 1 =< B. SQL/XML "O XML "M;\|,=v`Z,V{,2;\T,V{a2 (SQLSTATE 2200S)# a{D}]`M* XML#g{ string-expression Da{I*U,G4a{I*U;g {dk5*U,G4a{*U# XMLCONCAT XMLCONCAT /}+5X;vrP,CrP|,}?;(D XML dkTd?D"C# XMLCONCAT ( XML-expression , XML-expression ) #=* SYSIBM#;\+/}{8(*^({# XML-expression 8(}]`M* XML Dmo=# a{D}]`M* XML#a{G;v XML rP,CrP|,GUdk XML 5D" C#dkPDU5+;vT#g{NN XML-expression Da{I*U,G4a{I* U;g{?vdk5Da{*U,G4a{*U# >} ":XMLCONCAT ;aZdvPekUqr;P{#yP>}dv<+q=/Tv? IAT# *?E A00 M B01 9l?E*X,dP|,4{VErD01Pm#Z?E*X0S Oi\T"M# SELECT XMLCONCAT( XMLCOMMENT( ’Confirm these employees are on track for their product schedule’ ), XMLELEMENT( NAME "Department", 416 pureXML 8O XMLATTRIBUTES( E.WORKDEPT AS "name" ), XMLAGG( XMLELEMENT( NAME "emp", E.FIRSTNME ) ORDER BY E.FIRSTNME ) ) ) FROM EMPLOYEE E WHERE E.WORKDEPT IN (’A00’, ’B01’) GROUP BY E.WORKDEPT Ki/+zITBa{: CHRISTINE DIAN GREG SEAN VINCENZO MICHAEL XMLDOCUMENT XMLDOCUMENT /}5X_P%v XQuery D5ZcD XML 5,CD5Zc_P cvr`vSZc# XMLDOCUMENT ( XML-expression ) #=* SYSIBM#;\+/}{8(*^({# XML-expression 5X XML 5Dmo=#XML 5DrPn;(;\GtTZc (SQLSTATE 10507)# a{D}]`M* XML#g{NN XML-expression Da{I*U,G4a{I*U; g{dk5*U,G4a{*U# zID5ZcDSz+4BP=hPhvD==9l#dkmo=GZcr-S5r P,Zb)=hPVF*Z]rP# 1. g{Z]rP|,D5Zc,G4CD5ZcZZ]rPP+f;*D5ZcDS z# 2. Z]rPPI;vr`v-S5iID?v`ZrP+f;*D>Zc,CD>Z c|,+?v-S5?F*;*V{.Da{(`Z5.dekK%vUWV {)# 3. TZZ]rPPD?vZc,+*CZc9lBDnc1>#ZcDnc1>Gy 2ZCZcD{vSw(|(Zc>m0dsz)D1>#?v;4FZc_PB DZcj6# =< B. SQL/XML "} Z XML PPekQ9lD5# INSERT INTO T1 VALUES( 123, ( SELECT XMLDOCUMENT( XMLELEMENT( NAME "Emp", E.FIRSTNME ||’’||E.LASTNAME, XMLCOMMENT( ’This is just a simple example’ ) ) ) FROM EMPLOYEE E WHERE E.EMPNO = ’000120’ ) ) XMLELEMENT XMLELEMENT /}5XD XML 5G XQuery *XZc# XMLELEMENT ( NAME element-name , xmlnamespaces-declaration , xmlattributes-function  , element-content-expression  (1) EMPTY ON NULL (2) (3) OPTION NULL ON NULL USING XMLBINARY BASE64 USING XMLBINARY HEX ) ": 1 v18(AY;v xmlattributes-function r element-content-expression s,E\8 ( OPTION Sd# 2 v18(AY;v element-content-expression 1,E\8( NULL ON NULL r EMPTY ON NULL# 3 ;\`N8(,;Sd# 418 pureXML 8O #=* SYSIBM#;\+/}{8(*^({# NAME element-name 8( XML *XD{F#C{FGXkT XML ^({Fr QName (SQLSTATE 42634) q=vVD SQL j6#PXP'{FD|`j8E",kND W3C XML {FUdf6#g{G^({F,G4XkZwCrPyw{FUd0: (SQLSTATE 42635)# xmlnamespaces-declaration 8( XMLNAMESPACES ywzID XML {FUdyw#ywD{FUdZ XMLELEMENT /}wCrP#;\GqvVZm;Si/P,b){FUd 64 ;V{#y> 64 ;zk9C US-ASCII DI 65 vV{iIDS/(10 v}V"26 v!4V{"26vs4V{T0“+”M“/”)4m>?v~xF} ]r;}]D 6 ;T0S/PD;vIr!V{#b)V{Q;!P,y T|GGTI(CD==m>D#9CK=(1,`k}]Ds!H-< ~xF}]r;}]s 33%# =< B. SQL/XML "?vVZ(8 ;)#9 CK=(1,`k}]Ds!G-<~xF}]r;}]D=6# K/}9C*X{F"{FUdywDI!/O"tTDI!/OT0cvr`vT d?49I XML *XDZ]#a{G|, XML *XrU5D XML rP# a{D}]`M* XML#g{NN element-content-expression Td?I*U,G4a {I*U;g{yP element-content-expression Td?5*U"R NULL ON NULL ! nz',G4a{*U# "b v 9l+w*m;*X(CZ(e1!{FUd)DZ]xP4FD*X1,&Z; 4F*XPT=!{yw1!{FUd,T\br*SBD8z*XLP1!{F UdxI\DZcrP: – g{a{`M"G XML,G4|+*;* XML D>Zc,dZ]Gy]+ SQL }]53dA XML }]5(kND“}]`M.dD?F*;”PhvS G XML 5?F*;* XML 5Dm)PDfr3dA XML D element- content-expression Da{# – g{a{`M* XML,G4;c45a{GnrP#CrPPD3)nI\G D5Zc#rPPD?vD5Zc+f;*d%6SzrP#TZa{rP PD?vZc,+*CZc9lBDnc1>,|(dSzMtT#?v; 4FZc_PBDZcj6#;4F*XMtTZc+#td`M"M#T ZIrPP5XD;vr`v-S5iID?v`ZrP,+9lBDD> Zc(|,+?v-S5?F*;*V{.Da{),"aZ`Z5.de k%vUWV{#Z]rPPD`ZD>Zc+(}"CZ](`Z5.d ;ekUq)4O"I%vD>Zc#"Cs,+SZ]rPP>}Z]* c$HV{.DNND>Zc# 4. XML tTDa{rPMyP element-content-expression 8(a{rP+"CI* ;vrP,F*Z]rP#Z]rPPD`ZD>ZcDNNrP+O"I%v D>Zc#g{yP element-content-expression Td?""MM&m8n+I*Q9l*XZcDSz# 420 pureXML 8O 7. Q9l*XZcD`M"M;8(* xs:anyType,|D?vtTD`M"M;8 (* xdt:untypedAtomic#Q9l*XZcDZc{GZ NAME X|V.s8( D*X{F# v Z XMLELEMENT P9C{FUdDfr:’ ) AS "m" ) ) 5X: Z~v>}: VALUES XMLELEMENT( NAME "tst:c", XMLNAMESPACES( ’www.tst.com’ AS "tst" ), XMLQUERY( ’declare namespace ipo="www.ipo.com"; $m/ipo:a/@ipo:b’ PASSING XMLPARSE( DOCUMENT ’’ ) AS "m" ) ) 5X: >} ":XMLELEMENT ;aZdvPekUqr;P{#yP>}dv<+q=/Tv? IAT# =< B. SQL/XML "} 1:9C NULL ON NULL !n49l*X# SELECT E.FIRSTNME, E.LASTNAME, XMLELEMENT( NAME "Emp", XMLELEMENT( NAME "firstname", E.FIRSTNME ), XMLELEMENT( NAME "lastname", E.LASTNAME ) OPTION NULL ON NULL ) AS "Result" FROM EMPLOYEE E WHERE E.EDLEVEL = 12 Ki/+zITBa{: FIRSTNME LASTNAME Emp JOHN PARKER JOHN PARKER MAUDE SETRIGHT MAUDE SETRIGHT MICHELLE SPRINGER MICHELLE SPRINGER v >} 2:zIxPw*S*X6WD*XPmD*X# SELECT XMLELEMENT( NAME "Department", XMLATTRIBUTES( E.WORKDEPT AS "name" ), XMLAGG( XMLELEMENT( NAME "emp", E.FIRSTNME ) ORDER BY E.FIRSTNME ) ) AS "dept_list" FROM EMPLOYEE E WHERE E.WORKDEPT IN (’A00’, ’B01’) GROUP BY WORKDEPT Ki/+zITBa{: dept_list CHRISTINE SEAN VINCENZO MICHAEL v >} 3:4(6W XML *X,8(1! XML *X{FUd"9CSi/# SELECT XMLELEMENT( NAME "root", XMLNAMESPACES(DEFAULT ’http://mytest.uri’), XMLATTRIBUTES(cid), (SELECT XMLAGG( XMLELEMENT( NAME "poid", poid ) ) FROM purchaseorder WHERE purchaseorder.custid = customer.cid 422 pureXML 8O ) ) FROM customer WHERE cid = ’1002’ Cod5XTBZy*XPywK1!*X{FUdD XML D5: 5000 5003 5006 v >} 4:++2mmo=k XML {FUddO9C# (}+2mmo=9l XML *XRZ,; SQL odDd{X=9CK*X1,N N { F U d y w < & C 8 ( * * X 9 l D ; ? V # T B o d Z 9 C PURCHASEORDER m4( poid *XD+2mmo=M9C CUSTOMER m4(y *XD SELECT odP8(1! XML {FUd# WITH tempid(id, elem) AS (SELECT custid, XMLELEMENT(NAME "poid", XMLNAMESPACES(DEFAULT ’http://mytest.uri’), poid) FROM purchaseorder ) SELECT XMLELEMENT(NAME "root", XMLNAMESPACES(DEFAULT ’http://mytest.uri’), XMLATTRIBUTES(cid), (SELECT XMLAGG(elem) FROM tempid WHERE tempid.id = customer.cid ) ) FROM customer WHERE cid = ’1002’ Cod5XTBZy*XPywK1!*X{FUdD XML D5# 5000 5003 5006 ZBPodP,vZ9C CUSTOMER m4(y*XD SELECT odPyw1!* X{FUd: WITH tempid(id, elem) AS (SELECT custid, XMLELEMENT(NAME "poid", poid) FROM purchaseorder ) SELECT XMLELEMENT(NAME "root", XMLNAMESPACES(DEFAULT ’http://mytest.uri’), XMLATTRIBUTES(cid), (SELECT XMLAGG(elem) FROM tempid WHERE tempid.id = customer.cid ) ) FROM customer WHERE cid = ’1002’ Cod5XTBZy*XPywK1!*X{FUdD XML D5#r*Z+2mm o=P4( poid *Xx;Pyw1!*X{FUd,yT4(e poid *XD1! *X{FUd#Z XML D5P,IZ4(e poid *XD1!*X{FUd,"R poid *X;tZy*X xmlns="http://mytest.uri" D1!*X{FUd,yT poid *XD1!*X{FUdhC*UV{. ″″# =< B. SQL/XML " 5000 5003 5006 XMLFOREST XMLFOREST /}+5X XML 5,4 XQuery *XZcrP# XMLFOREST ( xmlnamespaces-declaration ,  , element-content-expression AS element-name  NULL ON NULL (1) OPTION EMPTY ON NULL USING XMLBINARY BASE64 USING XMLBINARY HEX ) ": 1 ;\`N8(,;Sd# #=* SYSIBM#;\+/}{8(*^({# xmlnamespaces-declaration 8( XMLNAMESPACES ywzID XML {FUdyw#ywD{FUdZ XMLFOREST /}wCrP#;\GqvVZm;Si/P,b){FUd 64 ;V{#y> 64 ;zk9C US-ASCII DI 65 vV{iIDS/(10 v}V"26 v!4V{"26vs4V{T0“+”M“/”)4m>?v~xF} ]r;}]D 6 ;T0S/PD;vIr!V{#b)V{Q;!P,y T|GGTI(CD==m>D#9CK=(1,`k}]Ds!H-< ~xF}]r;}]s 33%# XMLBINARY USING HEX y]T XML #=`M xs:hexBinary `kD(e,8(IC`k*.yx FV{#.yxF`k9C=v.yxFV{4m>?vVZ(8 ;)#9 CK=(1,`k}]Ds!G-<~xF}]r;}]D=6# K/}IC{FUdyw"9IC{FD;vr`vTd?T0;vr`v*XZc D*XZ]DI!/O#a{G|, XQuery *XrU5DrPD XML rP# a{D}]`M* XML#g{NN element-content-expression Td?I*U,G4a {I*U;g{yP element-content-expression Td?5*U"R NULL ON NULL ! nz',G4a{*U# XMLFOREST /}I9C XMLCONCAT M XMLELEMENT 4m>#}g,BP= vmo=ZoeOGH[D# XMLFOREST(xmlnamespaces-declaration, arg1 AS name1, arg2 AS name2 ...) XMLCONCAT( XMLELEMENT( NAME name1, xmlnamespaces-declaration, arg1 ), XMLELEMENT( NAME name2, xmlnamespaces-declaration, arg2 ) ... ) =< B. SQL/XML "} ":XMLFOREST ;aZdvPekUqr;P{#yP>}dv<+q=/Tv?I AT# 9C1!{FUd9l*X:# SELECT EMPNO, XMLFOREST( XMLNAMESPACES( DEFAULT ’http://hr.org’, ’http://fed.gov’ AS "d" ), LASTNAME, JOB AS "d:job" ) AS "Result" FROM EMPLOYEE WHERE EDLEVEL = 12 Ki/+zITBa{: EMPNO Result 000290 PARKER OPERATOR 000310 SETRIGHT OPERATOR 200310 SPRINGER OPERATOR XMLGROUP XMLGROUP /}5XxP%v XQuery D5ZcD XML 5,CD5Zc|,;v %6*XZc#bG;v[/mo=,+S?P3dAPS*XD;iPP5X%y XML D5#  , XMLGROUP ( expression AS qname-identifier  , ASC ORDER BY sort-key DESC 426 pureXML 8O  (1) ROW ″row″ OPTION ROW row-name ROOT ″rowset″ ROOT root-name AS ATTRIBUTES ) ": 1 ;\`N8(,;Sd# #=* SYSIBM#;\+/}{8(*^({# expression ?vQzI XML *XZcDZ](r?vQzItTD5)Imo=8(#expres- sion D}]`M;\Ga9/`M (SQLSTATE 42884)#Cmo=ITGNN SQL mo=#g{Cmo=;Gr%P}C,G4Xk8( qname-identifier# AS qname-identifier 8( XML *X{FrtT{Fw* SQL j6#qname-identifier Xk9C XML ^({Fr QName q= (SQLSTATE 42634)#kND W3C XML {FUdf6 TKbPXP'{FD|`j8E"#g{G^({F,G4XkZwCrPyw {FUd0: (SQLSTATE 42635)#g{48( qname-identifier,G4 expression XkGP{ (SQLSTATE 42703)#*X{FrtT{FGy]P{9CSP{A QName Dj+*e3d4(D# OPTION 8(CZ9l XML 5Dd{!n#g{48( OPTION Sd,G41!P*J C# ROW row-name 8(?P+3dAD*XD{F#g{48(K!n,G41!*X{F* “row”# ROOT root-name 8(y*XZcD{F#g{48(K!n,G41!y*X{F*“rowset”# AS ATTRIBUTES 8(?vmo=+3dAP{r qname-identifier d1tT{DtT5# ORDER BY 8([/P&mD,;Vi/OPDP3r#g{!TK ORDER BY Sd,r_ ORDER BY Sd;\xVP}]D3r,G4,;Vi/OPDP+NbEr# sort-key Er|ITGP{r sort-key-expression#"b,g{Er|*#?,G4|;aq U( ORDER BY SdPGy}CdvPD;C,+|;G;v#?,bb6E; PEr|# fr v g{ SELECT Sd|( ARRAY_AGG /},G4`, SELECT SdP ARRAY_AGG"LISTAGG"XMLAGGM XMLGROUP /}DyPwCXk8(`, D3r,r;8(3v3r (SQLSTATE 428GZ)# =< B. SQL/XML "} a)D>}yZBm T1,d{}P C1 M C2 |,f"*X5q=D}V}]# C1 C2 ----------- ----------- 12 -2 1- -- 4 record(s) selected. v >} 1:TB>}T>_P1!P*D XMLGroup i/Mdv,N"9C%v%6 *X4m>Cm: SELECT XMLGROUP(C1, C2)FROM T1 1 2 2 1 1 record(s) selected. v >} 2:TB>}T>_PtTPD3dD XMLGroup i/Mdv,N#X5}] +3dA*XtT,x;GqH0>}P;yw*6W*XvV: SELECT XMLGROUP(C1, C2 OPTION AS ATTRIBUTES) FROM T1 1 record(s) selected. 428 pureXML 8O v >} 3:TB>}T>1! y*Xf;* x *Xf ;* D XMLGroup i/Mdv,N#P C1 M C2 w* M *X5X,x5X/4P C1 Er: SELECT XMLGROUP( C1 AS "column1", C2 AS "column2" ORDER BY C1 OPTION ROW "entry" ROOT "document") FROM T1 1 2 1 2 XMLNAMESPACES XMLNAMESPACES yw(}Td?9l{FUdyw# xmlnamespaces-declaration: XMLNAMESPACES  , ( namespace-uri AS namespace-prefix ) (1) DEFAULT namespace-uri NO DEFAULT ": 1 DEFAULT r NO DEFAULT ;\Z XMLNAMESPACES DTd?P8(;N# #=* SYSIBM#;\+yw{8(*^({# Kyw;\CwX(/}(g XMLELEMENT"XMLFOREST M XMLTABLE)DT d?#a{G;vr`v XML {FUdyw,|G|,?vGUdk5D{FUdw Cr# namespace-uri 8({FUd(CJ4j6(URI)w* SQL V{.#?#g{KV{.#?CZ namespace-prefix,G4;(;\*U (SQLSTATE 42815)# namespace-prefix 8({FUd0:#0:GXk* XML NCName q=D SQL j6 (SQLSTATE 42634)#PXP'{FD|`j8E",kND W3C XML {FUdf6#0:; \* xml r xmlns,"R0:Z{FUdywPmPXk(; (SQLSTATE 42635)# =< B. SQL/XML "} ":XMLNAMESPACES ;aZdvPekUqr;P{#yP>}dv<+q=/T v?IAT# v >} 1:+zI XML *X adm:employee M XML tT adm:department,b=n QUINTANA 000140 NICHOLLS 200140 NATZ v >} 2:+zI XML *X“employee”MS*X“job”,XML *X“employee”k1! {FUd`X*,S*X“job”;9C1!{FUd,+dS*X“department”9C1 !{FUd# SELECT EMP.EMPNO, XMLELEMENT( NAME "employee", XMLNAMESPACES( DEFAULT ’http://hr.org’ ), EMP.LASTNAME, XMLELEMENT( NAME "job", XMLNAMESPACES( NO DEFAULT ), EMP.JOB, XMLELEMENT( NAME "department", XMLNAMESPACES( DEFAULT ’http://adm.org’ ), EMP.WORKDEPT ) ) ) FROM EMPLOYEE EMP WHERE EMP.EDLEVEL = 12 430 pureXML 8O Ki/+zITBa{: 000290 PARKEROPERATOR E11 000310 SETRIGHTOPERATOR E11 200310 SPRINGEROPERATOR E11 XMLPI XMLPI /}+5XxP%v XQuery &m8nZcD XML 5# XMLPI ( NAME pi-name ) , string-expression #=* SYSIBM#;\+/}{8(*^({# NAME pi-name 8(&m8nD{F#C{FGXk* XML NCName q=D SQL j6 (SQLSTATE 42634)#PXP'{FD|`j8E",kND W3C XML {FUd f6#{FZNN8}iOP<;\*%J“xml”(SQLSTATE 42634)# string-expression 5X5*V{.Dmo=#zIDV{.+*;* UTF-8,"RXk{O XML 1.0 frP8( XML &m8nDZ] (SQLSTATE 2200T): v CV{.;(;\|,“?>”,-rGKS.+U9&m8n# v V{.D?vV{ITG,sV{/i X’FFFE’ M X’FFFF’ TbDNN Uni- code V{# zIDV{.+I*Q9l&m8nZcDZ]# a{D}]`M* XML#g{ string-expression Da{I*U,G4a{I*U;g { string-expression Da{*U,G4a{*U#g{ string-expression GUV{.r _48(,G4a5XU&m8n# >} v >} 1:zI XML &m8nZc# SELECT XMLPI( NAME "Instruction", ’Push the red button’ ) FROM SYSIBM.SYSDUMMY1 Ki/+zITBa{: v >} 2:zIU XML &m8nZc# SELECT XMLPI( NAME "Warning" ) FROM SYSIBM.SYSDUMMY1 Ki/+zITBa{: =< B. SQL/XML ": v ?P+d;*{*“row”D XML *X,x?P+d;*P{d1*X{FD6W* X# v U5&mP*G NULL ON NULL#PPDU5+3dA1YS*XD;C#g{y PP5<*U,G4/}+5XU5# 432 pureXML 8O v BLOB M FOR BIT DATA }]`MD~xF`k=8* base64Binary `k# v D5Zc+T~===mSAP*X,T9 XML a{I*q=} Y(Bm T1 DP C1 M C2 |,f"*X5q=D}V}]: C1 C2 ----------- ----------- 12 -2 1- -- 4 record(s) selected. v >} 1:TB>}T>_P1!P*D XMLRow i/Mdv,N"9CP*XrP 4m>Cm: SELECT XMLROW(C1, C2) FROM T1 12 2 1 4 record(s) selected. v >} 2:TB>}T>_PtTPD3dD XMLRow i/Mdv,N#X5}]+ 3dA*XtT,x;GqH0>}P;yw*6W*XvV: SELECT XMLROW(C1, C2 OPTION AS ATTRIBUTES) FROM T1 4 record(s) selected. v >} 3:TB>}T>1! *Xf;* D XMLRow i/Mdv, N#P C1 M C2 +w* M *X5X,x C1 M C2 D\ M+Z *XP5X: SELECT XMLROW( C1 AS "column1", C2 AS "column2", C1+C2 AS "total" OPTION ROW "entry") FROM T1 123 2 1 4 record(s) selected. XMLTEXT XMLTEXT /}+5X_P%v XQuery D>ZcD XML 5,CD>Zc+dkT d?w*Z]# XMLTEXT ( string-expression ) #=* SYSIBM#;\+/}{8(*^({# =< B. SQL/XML "Zc# >} v >} 1:4(r% XMLTEXT i/# VALUES( XMLTEXT( ’The stock symbol for Johnson&Johnson is JNJ.’ ) ) Ki/+zITBrP/a{: 1 --------------------------------------------------- The stock symbol for Johnson&Johnson is JNJ. "b,D>Zc-}rP/s,“&”{E+3dA“&”# v >} 2:+ XMLTEXT k XMLAGG dO9CT9llOZ]#Y(m T DZ] gBy>: seqno plaintext emphtext ------ ----------------------------------------------------------- ------------- 1 This query shows how to construct mixed content 2 using XMLAGG and XMLTEXT. Without XMLTEXT3 XMLAGG will not have text nodes to group with other nodes, mixed content therefore, cannot generate SELECT XMLELEMENT( NAME "para", XMLAGG( XMLCONCAT( XMLTEXT( PLAINTEXT ), XMLELEMENT( NAME "emphasis", EMPHTEXT ) ) ORDER BY SEQNO ), ’.’ ) AS "result" FROM T Ki/+zITBa{: result ------------------------------------------------------------------------------- This query shows how to construct mixed content using XMLAGG and XMLTEXT. Without XMLTEXT , XMLAGG will not have text nodes to group with other nodes, therefore, cannot generate mixed content. 434 pureXML 8O XSLTRANSFORM 9C XSLTRANSFORM + XML }]*;*d{q=,|(+{O;V XML #=D XML D5*;*{Om;V#=DD5# XSLTRANSFORM AS CLOB(2G) ( xml-document USING xsl-stylesheet ) WITH xsl-parameters AS data-type data-type: ( -1 ) CHARACTER CHAR ( integer ) VARCHAR ( integer ) CHARACTER VARYING CHAR ( 1M ) CLOB CHARACTER LARGE OBJECT ( integer ) CHAR K M G ( 1M ) BLOB BINARY LARGE OBJECT ( integer ) K M G #=* SYSIBM#;\+K/}8(*^({# XSLTRANSFORM /}+ XML D5d;Im;V}]q=#IT+}]d;I XSLT &mwI&mDNNq=,|(+;^Z XML"HTML r?D># XSLTRANSFORM 9CDyP76TZ}]b5345Zc# N}D5Do(gBy>: enter value here ... y=mD5PXk|, xsl:param *X,"R_PkN}D5Py8(D{FtT 5`%dD{FtT5# AS data-type 8(a{}]`M#8(Da{}]`MD~=rT=$HtTXkc;$,\; |,d;sDdv (SQLSTATE 22001)#1!a{}]`M* CLOB(2G)# g{ xml-document N}r xsl-stylesheet N}*U,G4a{+*U# +OvNND5f"Z CHAR"VARCHAR r CLOB PP1I\a} K>}]>gN+ XSLT Cwq=/}f#*xPhC,H+TB=v>}D5ek= }]bP# INSERT INTO XML_TAB VALUES (1, ’ ’, ’

StudentID First Name Last Name Age University
436 pureXML 8O
’ ); BfwC XSLTRANSFORM /}T+ XML }]*;* HTML "T>v4# SELECT XSLTRANSFORM (XML_DOC USING XSL_DOC AS CLOB(1M)) FROM XML_TAB; a{*TBD5:

StudentID First Name Last Name Age
1 SteffenSiegmund 23
ZK>}P,dv* HTML "Rb)N}v0lzzD HTML Z]0a)D}]# by|a]>gN+ XSLT CwnUC'dvDq=/}f# 9C5w IT9Cm`=(4d; XML D5(dP|(9C XSLTRANSFORM /}"XQuery |Bmo=T0Ib?&CLr~qw4P XSLT &m)#TZf"Z DB2 XML P PDD5,k9C XSLT `H,9C XQuery |Bmo=IT|P'X4Pm`d;, bGr* XSLT Q9C1! SQL # =(gZ CURRENT SCHEMA (CDfwP(e)#&CZNN SQL j6DP 'V{M(g{Dfr2JCZKN}#;\+TV{.“SYS”*7DX5#=C ZK5#r* XSR Tsk XML #=f"bb?DTs;Z;,D{FUdP, yT XSR Ts;akfZZ XSR b?D}]bTs.d"z{Fe;# name VARCHAR(128) `MDdkMdvN},|8( XML #=D{F#XML #=D j{ SQL j6* rschema.name,"RTZ XSR PDyPTs&CG(;D#K N}S\U5#1*KN}a)U51,MazI;v(;5"f"Z XSR P# &CZNN SQL j6DP'V{M(g{Dfr2JCZKN}# schemalocation VARCHAR (1000) `MDdkN},|_PD5*U5,b8> XML #=wD5 D#=;C#KN}G XML #=Db?{,4,ITZ XML 5}D5P9C xsi:schemaLocation tT4j6wD5# © Copyright IBM Corp. 2006, 2013 439 content BLOB (30M) `MDdkN},|, XML #=wD5DZ]#KN}D5;\* U;Xka) XML #=D5# docproperty BLOB (5M) `MDdkN},8> XML #=wD5DtT#KN}IT_PU 5;qr,C5G XML D5# >} v >} 1:TB>}T>gNS|nPwC XSR_REGISTER }L: CALL SYSPROC.XSR_REGISTER( ’user1’, ’POschema’, ’http://myPOschema/PO.xsd’, :content_host_var, :docproperty_host_var) v >} 2:TB>}T>gNS Java &CLrwC XSR_REGISTER }L: stmt = con.prepareCall("CALL SYSPROC.XSR_REGISTER (?, ?, ?, ?, ?)"); String xsrObjectName = "myschema1"; String xmlSchemaLocation = "po.xsd"; stmt.setNull(1, java.sql.Types.VARCHAR); stmt.setString(2, xsrObjectName); stmt.setString(3, xmlSchemaLocation); stmt.setBinaryStream(4, buffer, (int)length); stmt.setNull(5, java.sql.Types.BLOB); stmt.registerOutParameter(1, java.sql.Types.VARCHAR); stmt.registerOutParameter(2, java.sql.Types.VARCHAR); stmt.execute(); XSR_ADDSCHEMADOC XML #=f"b (XSR) PD?v XML #=Q 9C1! SQL #=(gZ CURRENT SCHEMA (CDfwP(e)#&CZN N SQL j6DP'V{M(g{Dfr2JCZKN}#r* XSR Tsk XML #=f"bb?DTs;Z;,D{FUdP,yT XSR Ts;akfZZ XSR b?D}]bTs.d"z{Fe;# 440 pureXML 8O name VARCHAR(128) `MDdkN},|8( XML #=D{F#XML #=Dj{ SQL j6* rschema.name#Xk(}wC XSR_REGISTER }LQ-qCK XML #={F,"R XML #="aP;\jI#KN}D5;\*U#&CZNN SQL j6DP'V{M(g{Dfr2JCZKN}# schemalocation VARCHAR (1000) `MDdkN}IT_PU5,|8> XML #=wD5D#= ;C,"rdmS XML #=D5#KN}G XML #=Db?{,4,ITZ XML 5}D5P9C xsi:schemaLocation tT4j6wD5# content BLOB (30M) `MDdkN},||,ymSD XML #=D5DZ]#KN}D 5;\*U;Xka) XML #=D5# docproperty BLOB (5M) `MDdkN},|8>ymSD XML #=D5DtT#KN}I T_PU5;qr,C5G XML D5# >} CALL SYSPROC.XSR_ADDSCHEMADOC( ’user1’, ’POschema’, ’http://myPOschema/address.xsd’, :content_host_var, 0) XSR_COMPLETE XSR_COMPLETE }LGZ XML #="a}LP*wCDns;v}L,|+r XML #=f"b (XSR) "a XML #=#Z(}wCK}L4jI#="a.0,+;\ T XML #=xPi$# XSR_COMPLETE ( rschema , name , schemaproperties , isusedfordecomposition ) #=* SYSPROC# (^ C}LDwC_DZ(j6XkG SYSCAT.XSROBJECTS ?Q 9C1! SQL #=(gZ CURRENT SCHEMA (CDfwP(e)#&CZN N SQL j6DP'V{M(g{Dfr2JCZKN}#r* XSR Tsk XML #=f"bb?DTs;Z;,D{FUdP,yT XSR Ts;akfZZ XSR b?D}]bTs.d"z{Fe;# =< C. XSR f"}LM|n 441 name VARCHAR(128) `MDdkN},|8( XML #=D{F#XML #=Dj{ SQL j6(*T|4Pj{Tli)* rschema.name#Xk(}wC XSR_REGISTER }LQ-qCK XML #={F,"R XML #="aP;\j I#KN}D5;\*U#&CZNN SQL j6DP'V{M(g{Dfr2JC ZKN}# schemaproperties BLOB (5M) `MDdkN},|8(k XML #=`X*DtT(g{P)#g {;P`X*DtT,G4KN}D5*U5,rG;vCZm> XML #=tT D XML D5# isusedfordecomposition Integer `MDdkN},|8>Gq+ XML #=CZVb#g{*+ XML # =CZVb,G4&+K5hC* 1;qr&hC* 0# >} CALL SYSPROC.XSR_COMPLETE( ’user1’, ’POschema’, :schemaproperty_host_var, 0) XSR_DTD XSR_DTD }LCZr XML #=f"b (XSR) "aD5`Myw(DTD)# XSR_DTD ( rschema , name , systemid , publicid , content ) #=* SYSPROC# (^ C}LDwC_DZ(j6XkAY_PBPdP;V(^rX(: v DBADM (^# v IMPLICIT_SCHEMA }]b(^(g{ SQL #=;fZ)# v CREATEIN X((g{ SQL #=fZ)# rschema VARCHAR (128) `MDdkMdvN},|8( DTD D SQL #=#SQL #= GC4Z XSR Pj6K DTD D SQL j6D;?V#(SQL j6Dm;?VG I name N}a)D#)KN}IT_PU5,b8>Q9C1! SQL #=(g Z CURRENT SCHEMA (CDfwP(e)#&CZNN SQL j6DP'V{ M(g{Dfr2JCZKN}#;\+TV{.“SYS”*7DX5#=CZK 5#r* XSR Tsk XML #=f"bb?DTs;Z;,D{FUdP,yT XSR Ts;akfZZ XSR b?D}]bTs.d"z{Fe;# name VARCHAR (128) `MDdkMdvN},|8( DTD D{F#DTD Dj{ SQL j6* rschema.name,"RTZ XSR PDyPTs&CG(;D#KN}S\U 5#1*KN}a)U51,MazI;v(;5"f"Z XSR P#&CZNN SQL j6DP'V{M(g{Dfr2JCZKN}# 442 pureXML 8O systemid VARCHAR (1000) `MDdkN},|8( DTD D53j6#DTD D53j6 &Ck XML 5}D5D DOCTYPE ywr_ ENTITY yw(g{9CD0,Z 0fmSX|V SYSTEM w*0:)PD DTD D3;J4j6`%d#KN} D5;\*U#53j6Ik+Cj6,18(# publicid VARCHAR (1000) `MDdkN},|8( DTD D+Cj6#DTD D+Cj6 &Ck XML 5}D5D DOCTYPE ywr_ ENTITY yw(g{9CD0,Z 0fmSX|V PUBLIC w*0:)PD DTD D3;J4j6`%d#KN}S \U5,R&vZ XML 5}D5D DOCTYPE ywPr_Z ENTITY ywP, 18(19C# content BLOB (30M) `MDdkN},||, DTD D5DZ]#KN}D5;\*U# >} "aI53j6 http://www.test.com/person.dtd M+Cj6 http://www.test.com/person j 6D DTD: CALL SYSPROC.XSR_DTD ( ’MYDEPT’ , ’PERSONDTD’ , ’http://www.test.com/person.dtd’ , ’http://www.test.com/person’, :content_host_variable ) XSR_EXTENTITY XSR_EXTENTITY }LCZr XML #=f"b (XSR) "ab?5e# XSR_EXTENTITY ( rschema , name , systemid , publicid , content ) #=* SYSPROC# (^ C}LDwC_DZ(j6XkAY_PBPdP;V(^rX(: v DBADM (^# v IMPLICIT_SCHEMA }]b(^(g{ SQL #=;fZ)# v CREATEIN X((g{ SQL #=fZ)# rschema VARCHAR (128) `MDdkMdvN},|8(b?5eD SQL #=#SQL # =GC4Z XSR Pj6Kb?5eD SQL j6D;?V#(SQL j6Dm;? VGI name N}a)D#)KN}IT_PU5,b8>Q9C1! SQL #= (gZ CURRENT SCHEMA (CDfwP(e)#&CZNN SQL j6DP' V{M(g{Dfr2JCZKN}#;\+TV{.“SYS”*7DX5#=CZ K5#r* XSR Tsk XML #=f"bb?DTs;Z;,D{FUdP,y T XSR Ts;akfZZ XSR b?D}]bTs.d"z{Fe;# =< C. XSR f"}LM|n 443 name VARCHAR(128) `MDdkMdvN},|8(b?5eD{F#b?5eDj{ SQL j6* rschema.name,"RTZ XSR PDyPTs&CG(;D#KN}S \U5#1*KN}a)U51,MazI;v(;5"f"Z XSR P#&CZ NN SQL j6DP'V{M(g{Dfr2JCZKN}# systemid VARCHAR (1000) `MDdkN},|8(b?5eD53j6#b?5eD53 j6&Ck ENTITY yw(g{9CD0,Z0fmSX|V SYSTEM w*0 :)PDb?5eD3;J4j6`%d#KN}D5;\*U#53j6Ik+ Cj6,18(# publicid VARCHAR (1000) `MDdkN},|8(b?5eD+Cj6#b?5eD+C j6&Ck ENTITY yw(g{9CD0,Z0fmSX|V PUBLIC w*0:) PDb?5eD3;J4j6`%d#KN}S\U5,R&vZ XML 5}D5 D DOCTYPE ywPr_Z ENTITY ywP,18(19C# content BLOB (30M) `MDdkN},||,b?5eD5DZ]#KN}D5;\*U# >} "aI53j6 http://www.test.com/food/chocolate.txt M http://www.test.com/food/ cookie.txt j6Db?5e: CALL SYSPROC.XSR_EXTENTITY ( ’FOOD’ , ’CHOCLATE’ , ’http://www.test.com/food/chocolate.txt’ , NULL , :content_of_chocolate.txt_as_a_host_variable ) CALL SYSPROC.XSR_EXTENTITY ( ’FOOD’ , ’COOKIE’ , ’http://www.test.com/food/cookie.txt’ , NULL , :content_of_cookie.txt_as_a_host_variable ) XSR_UPDATE XSR_UPDATE }LCZ"9 XML #=f"b (XSR) PDVP XML #=#b+J mz^Dr)9VP XML #=,TcI9C|4i$QfZrBekD XML D5# XSR_UPDATE ( rschema1 , name1 , rschema2 , name2 , dropnewschema ) #=* SYSPROC# ZwC XSR_UPDATE .0,XkZ XSR P"a"jI8(*C}LN}D-< XML #=MB XML #=#b) XML #=9Xkf]#PXf]T*sDj8E",kN D]x XML #=Df]T*s# 444 pureXML 8O (^ }LwC_DZ(j65PDX(XkAY|(BPdP;n(^rX(: v DBADM (^# v T?Z9CB XML #=|B-< XML #=sGq &+B XML #=>}#+KN}hC*NNGc5+ }#KN}D5;\*U# >} CALL SYSPROC.XSR_UPDATE( ’STORE’, ’PROD’, ’STORE’, ’NEWPROD’, 1) XML #= STORE.PROD DZ]|B* STORE.NEWPROD DZ],"R XML #= STORE.NEWPROD ;>}# =< C. XSR f"}LM|n 445 XSR |n REGISTER XMLSCHEMA r XML #=f"b (XSR) "a XML #=# (^ *BPdP;V(^: v DBADM v IMPLICIT_SCHEMA }]b(^(g{ SQL #=;fZ) v CREATEIN X((g{ SQL #=fZ) XhD,S Database |no( REGISTER XMLSCHEMA schema-URI FROM content-URI WITH properties-URI AS relational-identifier xml-document-subclause COMPLETE WITH schema-properties-URI ENABLE DECOMPOSITION xml-document-subclause: ( ADD document-URI FROM content-URI ) WITH properties-URI |nN} schema-URI 8(}Z"aD XML #=D URI,) XML 5}D5}C# FROM content-URI 8( XML #=D5yZD URI#v'VID~=8 URI 8(D>XD~# WITH properties-URI 8( XML #=DtTD5D URI#v'VID~=8 URI 8(D>XD~# AS relational-identifier 8(ITC4m>}Z"aD XML #=D{F#IT+X5{F8(*I= ?ViID SQL j6,b=?VVpG SQL #=M XML #={,dq= gB:SQLschema.name#g{48(#=,G49C1!X5#=(|GZ (CDfw CURRENT SCHEMA P(eD)#g{4a){F,G4+zI (;5# 446 pureXML 8O COMPLETE 8>;YmS XML #=D5#g{8(KKN},G4ai$#=,"RZ 4"VNNms1+C#=jG*IC# WITH schema-properties-URI 8( XML #=DtTD5D URI#v'VID~=8 URI 8(D>XD~# ENABLE DECOMPOSITION 8(*+K#=CZVb XML D5# ADD document-URI 8(*mSAK#=D XML #=D5D URI,r*+Sm;v XML D5P }CCD5# FROM content-URI 8( XML #=D5yZD URI#v'VID~=8 URI 8(D>XD~# WITH properties-URI 8( XML #=DtTD5D URI#v'VID~=8 URI 8(D>XD~# >} REGISTER XMLSCHEMA ’http://myPOschema/PO.xsd’ FROM ’file:///c:/TEMP/PO.xsd’ WITH ’file:///c:/TEMP/schemaProp.xml’ AS user1.POschema 9C5w v ZIT}C XML #=D5"+|CZi$M"M.0,XkHr XSR "a|#K |n+4P XML #="a}LDZ;=,4,"a XML #=wD5#XML #= "a}LDns;=*sI&XT XML #=KP COMPLETE XMLSCHEMA |n#r_, g{;|(d{ XML #=D5,G4Z"v REGISTER XMLSCHEMA |n1=x COM- PLETE X|V,Tc(};v=hMjI"a}L# v Z}]bP"a XML #=1,y]C XML #=Ds!,I\h*|sD&CLr Q (applheapsz)#(is!* 1024,+G|sD#=+h*|`Zf# ADD XMLSCHEMA DOCUMENT ZjI"a.0,+;vr`v XML #=D5mSAVPD;j{ XML #=# (^ h*BP(^: v C'j6XkG SYSCAT.XSROBJECTS ?;YmS XML #=D5#g{8(KKN},G4ai$#=,"RZ 4"VNNms1+C#=jG*IC# WITH schema-properties-URI 8( XML #=DtTD5D URI#v'VD~=8 URI# ENABLE DECOMPOSITION 8(*+K#=CZVb XML D5# >} ADD XMLSCHEMA DOCUMENT TO JOHNDOE.PRODSCHEMA ADD ’http://myPOschema/address.xsd’ FROM ’file:///c:/TEMP/address.xsd’ COMPLETE XMLSCHEMA jIZ XML #=f"b (XSR) "a XML #=D}L# (^ v C'j6XkG SYSCAT.XSROBJECTS ?XD~#;\Z XML #="aDjIWNE\8(#=tTD5# ENABLE DECOMPOSITION 8>IT+#=CZVb XML 5}D5# >} COMPLETE XMLSCHEMA user1.POschema WITH ’file:///c:/TEMP/schemaProp.xml’ 9C5w ZjI XML #="a}L.0,;\}C XML #=r_+|CZi$r"M#K| n+jII REGISTER XMLSCHEMA |n*X D~# AS relational-identifier 8(ITC4m>}Z"aD XML TsD{F#IT+X5{F8(*I= ?ViID SQL j6,b=?VVpGX5#=M{F,|G.dIdcVt *#}g,“JOHNDOE.EMPLOYEEDTD”#g{48(X5#=,G4a9C Z(CDfw CURRENT SCHEMA P(eD1!X5#=#g{48({F, G4aT/zI;v{F# DTD 8(}Z"aDTsG“}]`M(e”(DTD)D5# EXTERNAL ENTITY 8(}Z"aDTsGb?5e# >} 1. a)TBy> XML D5,|}CK;vb?5e: ]> c h*"aCb?5e.s,E\I&X+KD5ek= XML PP#TB|na" a;v5e,5eZ]f"Z C:\TEMP >X: REGISTER XSROBJECT ’http://www.xmlwriter.net/copyright.xml’ FROM ’c:\temp\copyright.xml’ EXTERNAL ENTITY 2. a)TB XML D5,N,|}CK;v DTD: Subjects available in Mechanical Engineering. 2.303 Fluid Mechanics ... h*"aC DTD .s,E\I&X+KD5ek= XML PP#TB|na"a DTD,DTD (ef"Z C:\TEMP >X"Rk DTD `X*DX5j6* “TEST.SUBJECTS”: REGISTER XSROBJECT ’http://www.xmlwriter.net/subjects.dtd’ FROM ’file:///c:/temp/subjects.dtd’ AS TEST.SUBJECTS DTD 3. a)TBy> XML D5,|}CK;v+Cb?5e: 450 pureXML 8O ]> c h*"aC+Cb?5e.s,E\I&X+KD5ek= XML PP#TB|n a"a;v5e,5eZ]f"Z C:\TEMP >X: REGISTER XSROBJECT ’http://www.w3.org/xmlspec/copyright.xml’ PUBLIC ’-//W3C//TEXT copyright//EN’ FROM ’file:///c:/temp/copyright.xml’ EXTERNAL ENTITY UPDATE XMLSCHEMA Z XML #=f"b (XSR) P9C;V XML #=|Bm;V XML #=# (^ *BPdP;V(^: v DBADM v T?Z9CB XML #=|B-< XML #=s&+B XML #=>}# >} UPDATE XMLSCHEMA JOHNDOE.OLDPROD WITH JOHNDOE.NEWPROD DROP NEW SCHEMA XML #= JOHNDOE.OLDPROD DZ]|B* JOHNDOE.NEWPROD DZ],"R XML #= JOHNDOE.NEWPROD ;>}# =< C. XSR f"}LM|n 451 9C5w v -< XML #=MB XML #=Xkf]#PXf]T*sDj8E",kND:] x XML #=Df]T*s;# v Z|B XML #=.0,XkZ XML #=f"b (XSR) P"a-<#=MB#=# 452 pureXML 8O =< D. DB2 Lr – LL v DB2 i. – PDF D~(IBX) – PDF D~(Z DB2 PDF DVD P) – !"fi. v |nPoz – |noz – {"oz ":DB2 E"PDwbD|B5JH PDF i.r2=4i.D|B5J_#*q!n BE",k20ICDD5|Br_ND ibm.com OD DB2 E"PD# zITZ_CJ ibm.com ODd{ DB2 c:http:// www.ibm.com/software/data/sw-library/# D54! RGG#XSzT DB2 D5D4!#g{zkMgNDF DB2 D5av(i,kr db2docs@ca.ibm.com "MgSJ~#DB2 D5!i+DAzDyP4!,+^(1S xzp4#k!I\a)_eD>},byRGE\|CXKbzyXDDJb#g {z*a)PX_ewbrozD~D4!,kSOjbM URL# k;*9CTOgSJ~X7k DB2 M''Vz9*5#g{zv=D5^(bvD DB2 M-kf># !\b)mj6i.P!"f,+I\4ZzyZzRrXxa)# ?N|BVa1,m%EDVaDnBf># ":DB2 E"PDD|B5JH PDF r2=4i.D|B5J_# © Copyright IBM Corp. 2006, 2013 453 m 76. DB2 SQL 4,oz DB2 z7kTI\d1 SQL oda{Du~5X SQLSTATE 5#SQLSTATE oz 5w SQL 4,M SQL 4,`zkD,e# }L *t/ SQL 4,oz,kr*|nP&mw"dk: ? sqlstate or ? class code =< D. DB2 P'D 5 ; SQL 4,,class code m>C SQL 4,D0 2 ;# }g,? 08003 T> 08003 SQL 4,Doz,x ?08T> 08 `zkDoz# CJ;,f>D DB2 E"PD zITZ ibm.com® OD;,E"PDPR=d{f> DB2 z7DD5# XZKNq TZ DB2 V10.1 wb,DB2 E"PD URL G http://publib.boulder.ibm.com/infocenter/ db2luw/v10r1# TZ DB2 V9.8 wb,DB2 E"PD URL G http://publib.boulder.ibm.com/infocenter/ db2luw/v9r8/# TZ DB2 V9.7 wb,DB2 E"PD URL G http://publib.boulder.ibm.com/infocenter/ db2luw/v9r7/# TZ DB2 V9.5 wb,DB2 E"PD URL G http://publib.boulder.ibm.com/infocenter/ db2luw/v9r5# TZ DB2 V9.1 wb,DB2 E"PD URL G http://publib.boulder.ibm.com/infocenter/ db2luw/v9/# TZ DB2 V8 wb,k*A DB2 E"PD URL:http://publib.boulder.ibm.com/infocenter/ db2luw/v8/# |B20ZFczrZ?x~qwOD DB2 E"PD 20Z>XD DB2 E"PDXk(ZxP|B# *<.0 XkQ20 DB2 V10.1 E"PD#PXj8E",kND20 DB2 ~qwPD“9C DB2 20r<420 DB2 E"PD”wb#yPJCZ20E"PDDHvu~M^ F,yJCZ|BE"PD# XZKNq ITT/rV/|BVPD DB2 E"PD: v T/|B+|BVPDE"PD&\?~MoT#T/|BD;vEcG,kV/ |B`H,E"PDD;IC1dOL#mb,T/|BIhC*w*(ZKPD d{z&mw5D;?VKP# v IT9CV/|B=(4|BVPDE"PD&\?~MoT#T/|BITuL |B}LPD#z1d,+g{zkmS&\?~roT,G4Xk4PV/} L#}g,g{>XE"PDnu20DG"oM(of,xVZ9*20Bo f;G4V/|B+20Bof,"|BVPE"PDD&\MoT#+G,V/ |B*szV/#9"|BMXBt/E"PD#Z{v|B}LZdE"PD; IC#ZT/|B}LP,E"PDvZ|BjIs#9$wTXBt/E"P D# 456 pureXML 8O Kwbj85wKT/|BD}L#PXV/|BD8>E",kND“V/|B20 ZzDFczrZ?x~qwOD DB2 E"PD”wb# }L *T/|B20ZFczrZ?x~qwOD DB2 E"PD: 1. Z Linux Yw53O, a. /@AE"PDD20;C#1!ivB,DB2 E"PD20Z /opt/ibm/ db2ic/V10.1 ?: update-ic 2. Z Windows Yw53O, a. r*|n0Z# b. /@AE"PDD20;C#1!ivB,DB2 E"PD20Z \IBM\DB2 Information Center\V10.1 ? m > Program Files ?BDT0|BsD wb#g{E"PD|B;IC,G4aZU>PmS{"#U>D~;Z doc\ eclipse\configuration ?D~{FGfzzID`E#}g, 1239053440785.log# V/|B20ZFczrZ?x~qwOD DB2 E"PD g{zQZ>X20 DB2 E"PD,G4IS IBM q!D5|B"xP20# XZKNq V/|B20Z>XD DB2 E"PD*sz: 1. #9FczOD DB2 E"PD,;sT@"==XBt/E"PD#g{T@"= =KPE"PD,G4xgODd{C'+^(CJE"PD,rxzIT&C| B#DB2 E"PDD$w>f>\GT@"==KP# 2. 9C“|B”&\?~4i4ICD|B#g{PzXk20D|B,G4k9C“ |B”&\?~4q!"20b)|B# ":g{zD73*sZ;(4,SArXxDzwO20 DB2 E"PD|B,k 9C;(Q,SArXx"Q20 DB2 E"PDDzw+|B>c5qA>XD~ 53#g{xgPPm`C'+20D5|B,G4IT(}Z>X2*|B>c Fw5q"*|B>c4(zm4uL?vK4P|Byh*D1d# g{a)K|B|,k9C“|B”&\?~4q!b)|B|#+G,;PZ%z ==BE\9C“|B”&\?~# =< D. DB2 O,TsP>ZK?VD|nXk w*\m1KP#*r*_P+f\m1X(D|na>{r XFfe > \m$_ > ~q#R|%w DB2 E "PD~q,"!q#9# v Z Linux O,dkTB|n: /etc/init.d/db2icdv10 stop 2. T@"==t/E"PD# v Z Windows O: a. r*|n0Z# b. / @ A E " P D D 2 0 ; C # 1 ! i v B , DB2 E " P D 2 0 Z Program_Files\IBM\DB2 Information Center\V10.1 ? Program Files ?: help_start 531! Web /@w+r*TT>@"E"PD# 3. %w|B4%( )#(XkZ/@wPtC JavaScript#) ZE"PDDR_f eO,%wiR|B# +T>VPD5D|BPm# 4. *t/20}L,kliz*20D!n,;s%w20|B# 5. Z20xLjIs,k%wjI# 6. *#9@"E"PD,k4PBPYw: v Z Windows O,/@A20?: help_end 458 pureXML 8O ":help_end E>|,2+X#99C help_start E>t/DxLyhD|n# ;*9CNNd{=(4#9 help_start E># 7. XBt/ DB2 E"PD# v Z Windows O,%w*< > XFfe > \m$_ > ~q#R|%w DB2 E "PD~q,"!qt/# v Z Linux O,dkTB|n: /etc/init.d/db2icdv10 start a{ |BsD DB2 E"PD+T>BDT0|BsDwb# DB2 LL DB2 LLozzKb DB2 }]bz7Dwv=f#b)NLa)Kp=8>E"# *<.0 zITZE"PDPi4 XHTML fDLL:http://publib.boulder.ibm.com/infocenter/ db2luw/v10r1/# 3)NL9CKy>}]rzk#PXdX(NqDNNHvu~Dhv,kNDL L# DB2 LL *i4LL,k%wjb# pureXML 8OPD:pureXML; hC DB2 }]bTf" XML }]T0T>z XML }]f"w4Py>Y w# DB2 JOoOE" RGa)KwVwyDJOoOMJb7(E"4ozz9C DB2 }]bz7# DB2 D5 zITZ6JOoOMw{}]bT\7r_ DB2 E"PDD“}]by!”? VPR=JOoOE",b)E"|,TBZ]: v PXgN9C DB2 oO$_M5CLr4tkM7(JbDE"# v ;)n#{JbDbv=8# v ca)K8rnB DB2 vfo"x7*:http://www.ibm.com/support/entry/portal/Overview/ Software/Information_Management/DB2_for_Linux,_UNIX_and_Windows =< D. DB2 cD9Cun0TBunMu~# vK9C:;*#tyPD(P(yw,zMIT*vK"GL59C4Fb)vf o#4- IBM w7,b,z;ITV""9>rFwb)vfordPNN?VD] ow7# L59C:;*#tyPD(P(yw,zMITvZs5Z4F"V"M9>b) vfo#4- IBM w7,b,z;ITFwb)vfoD]ow7,r_ZzDs5 b?4F"V"r9>b)vfordPDNN?V# ({:}G>mI(Pw7Zh,qr;CZhTb)vfordP|,DNNE ""}]"m~rd{*6z(DNNmI("mI$r({,^[Gw>D9G5 ,D# IBM #ty]TmDPO,O*TvfoD9Cp&K IBM D(f(I IBM Tm7 ()r4}7q-TO8>E"1,7XK&yZh(^D({# ;Pzj+q-yPJCD(IM(f,|(yPD@zvZ(IM(f,zEIT BX"vZrYvZCE"# IBM Tb)vfoDZ];wNN#$#b)vfo“4V4”a),;=PNNV`D (^[Gw>D9G5,D)#$,|(+;^Z5,DXZJzMJCZ3VX( C>D#$# IBM Lj: IBM" IBM UjM ibm.com G International Business Machines Corp., Z +rm`\=xr"aDLjr"aLj#d{z7M~q{FI\G IBM rd{+ >DLj#10D IBM LjPm,IS Web >c www.ibm.com/legal/ copytrade.shtmlqC 460 pureXML 8O =< E. yw >E"G*Z@za)Dz7M~q`4D#PXG IBM z7DE"GyZWNvf KD51DIqE"Raf1|B# IBM I\Zd{zRrXx;a)>D5PV[Dz7"~qr&\XT#PXz10 yZxrDz7M~qDE",krz1XD IBM zmI/#NNT IBM z7"L rr~qD}C"GbZw>r5>;\9C IBM Dz7"Lrr~q#;*;V8 IBM D*6z(,NN,H&\Dz7"Lrr~q,I\Q5Pr}Zjkk>D5Z]PXDwn({#a)>D5"4ZhC '9Cb)({DNNmI#zITCif==+mIi/Dy: IBM Director of Licensing IBM Corporation North Castle Drive Armonk, NY 10504-1785 U.S.A. PX+VZV{/ (DBCS) E"DmIi/,kkzyZzRrXxD IBM *6z( ?E*5,rCif==+i/Dy: Intellectual Property Licensing Legal and Intellectual Property Law IBM Japan, Ltd. 1623-14, Shimotsuruma, Yamato-shi Kanagawa 242-8502 Japan >un;JC"zrNNbyDunk1X(I;;BDzRrXx:International Busi- ness Machines Corporation“4V4”a)>vfo,;=PNNV`D(^[Gw>D9 G5,D)#$,|(+;^Z5,DPXGV("JzMJCZ3VX(C>D# $#3)zRrXxZ3);WP;Jmb}w>r5,D#$#rK>unI\; JCZz# >E"PI\|,JODBf>P#IBM ITf1T>JOPhvDz7M/rLrxPD xM/r|D,x;mP(*# >E"PTG IBM Web >cDNN}C<;G*K=cp{Ea)D,;TNN== d1TG) Web >cD#$#G) Web >cPDJO;GK IBM z7JOD;? V,9CG) Web >cx4DgU+IzTPP## IBM IT4|O*J1DNN==9CrV"zya)DNNE"x^kTzP#NN pN# © Copyright IBM Corp. 2006, 2013 461 >LrD;mI=g{*KbPXLrDE"To=gB?D:(i) JmZ@"4(DL rMd{Lr(|(>Lr).dxPE";;,T0 (ii) JmTQ-;;DE"xP `%9C,kkBPX7*5: IBM Canada Limited U59/3600 3600 Steeles Avenue East Markham, Ontario L3R 9Z7 CANADA ;*qXJ1DunMu~,|(3)iNBD;(}?D6Q,JOPhvDmILr0dyPICDmIJOyI IBM @] IBM M'-i"IBM zJm~mI-irNN,H-iPDuna)# K&|,DNNT\}]D5DC'&1i$dX(73DJC}]# f0G IBM z7DE"ISb)z7D)&L"dvf5wrd{I+*qCDJO Pq!#IBM ;PTb)z7xPbT,2^(7OdT\D+7T"f]TrNNd {XZG IBM z7Dyw#PXG IBM z7T\DJb&1rb)z7D)&La v# yPXZ IBM 44=rrbrDywK?jMb8xQ# >E"I\|,ZU#5qYwP9CD}]M(fD>}#*K!I\j{X5w b)>},>}PI\a|(vK"+>"7FMz7D{F#yPb){FE"|(4oTN=Dy>&CLr,b)y>5w;,Yw=(OD`L=(# g{G*4UZ`4y>LrDYw=(OD&CLr`LSZ (API) xP&CLrD *""9C"-zrV",zITNNN=Tb)y>LrxP4F"^D"V", x^kr IBM 6Q#b)>}"4ZyPu~Bw+fbT#rK,IBM ;\##r 5>b)LrDI?T"I,$Tr&\#Ky>Lr“4V4”a),R;=PNN V`D#$#TZ9CKy>Lry}pDNNp5,IBM +;P#pN# 2b)y>LrD?]=4rdNN?VrNN\zz7,Dy>Lr\zv4D# © Copyright IBM Corp. _enter the year or years_. All rights reserved. Lj IBM Lj:IBM" IBM UjM ibm.com G International Business Machines Corp., Z +rm`\=xr"aDLjr"aLj#d{z7M~q{FI\G IBM rd{+ 462 pureXML 8O >DLj#10D IBM LjPm,IS Web >c www.ibm.com/legal/ copytrade.shtml O“f(MLjE"”?Vq!# BPwnGd{+>DLjr"aLj v Linux G Linus Torvalds Z@zM/rd{zRrXxD"aLj# v Java MyPyZ Java DLjMUjG Oracle M/rdS+>DLjr"aLj# v UNIX G The Open Group Z@zMd{zRrXxD"aLj# v Intel"Intel Uj"Intel Inside"Intel Inside Uj"Celeron"Intel SpeedStep"Itanium M Pentium G Intel Corporation rdS+>Z@zMd{zRrXxDLjr"a Lj# v Microsoft"Windows"Windows NT M Windows UjG Microsoft Corporation Z@ zM/rd{zRrXxDLj# d{+>"z7r~q{FI\Gd{+>DLjr~qjG# =< E. yw 463 464 pureXML 8O w} [B] oz SQL od 455 `LoT XML 217 `kM SQL /} Ev 248 d;mo= Vx}]b73 276 m 4( XML P 37 w} 151 mo= |B XML }] 180 |B XML }]1Dms 180 mVx pureXML T\ 275 XML T\ 275 [C] i/ yZ XML }]Dw} 108 a9 61 T\ 53\mUdD0l 286 i/oT XML }] 64 i/ XML }] =( HO 64 Ev 61 SQL +]N}jG 97 +]#? 97 +]P{ 98 Ev 63 XMLEXISTS =J 93 XMLQUERY /} 69 XMLTABLE /} 82 &m8nZc hv 14 %"w XML 'V 45 f" *s XML D5 34 pureXML 1 XML }]5w{ 204 f"}L "a XSR Ts 186 f"}LoO&\ XSR_GET_PARSING_DIAGNOSTICS f"}L 50, 51 f" XML }] `k G Unicode 56 Ev 287 {FA CCSID 3d 298, 397 "bBn 288 ek Ev 37 P 38 Ev 1 |B 179 ms XQuery |B 180 [D] sTs(LOB) } `vD5 317 P> 373 3dA%vmD`v5 381, 383 53dA%vm 377, 378 53dA`vm 380 }]`Mf]T 385 ^F 389 \zD4S`M 369 i$ 367 Ec 315 "a#= 316 © Copyright IBM Corp. 2006, 2013 465 x"MD XML #=Vb (x) "M Ev 330 f6 330 Qw 109 [E] ~xF XML q= Java &CLr 226 [F] "< XML 5 >} mP 113 #?5 111 %vm 112 `vm 113 \a 111 XQuery 114 SQL/XML /} XbV{&m 114 \a 110 =( Perl O*,S 244 ,S 244 VbPDP/ 373 Vxm pureXML T\ 275 XML T\ 275 (zf"wTs XML }]5w{ 204 [G] |B DB2 E"PD 456, 457 XML P 179 XML D5 183 |Bmo= iO 180 +2oTKP1 (CLR) }L XML 'V 254 XQuery 'V 254 JOoO yZ XML }]Dw} #{Jb 173 D5b\ 145 ^' XML 5 143 CREATE INDEX '\ 145 SQL20305N 174 SQL20306N 176 LL 459 *zE" 459 XML Vb 390 XZ>i i i5 XML 35 }L T XML N}Md?xPXvDa{ 247 T XML N}Md?xPd5Da{ 247 XML d? 245 N} 245 XSR_ADDSCHEMADOC 440 XSR_COMPLETE 441 XSR_DTD 442 XSR_EXTENTITY 443 XSR_REGISTER 439 XSR_UPDATE 444 [H] /} j? XMLATTRIBUTES 414 466 pureXML 8O /} (x) j? (x) XMLCOMMENT 416 XMLCONCAT 416 XMLDOCUMENT 417 XMLELEMENT 418 XMLFOREST 424 XMLGROUP 426 XMLNAMESPACES 429 XMLPI 431 XMLQUERY 80 XMLROW 432 XMLTEXT 433 XSLTRANSFORM 435 m XMLTABLE 89 [/ XMLAGG 413 P XMLAGG 413 /}mo==h 139 P _P UNIQUE SdDw}| 151 w} 151 [J] yZ XML }]Dw} i/ 103 XB4( 150 Vxm 275 Ev 129 JOoO #{Jb 173 D5b\ 145 ^' XML 5 143 CREATE INDEX '\ 145 SQL20305N 174 SQL20306N 176 ,S=JD?F`M*;fr 106 _- 148 #}i/s5 108 ?F(;u? 147 }]bTsX* 148, 149 }]`M DV 106 *; 143 *;\am 146 XQuery #=mo= 141 ^'w}Ts 150 om 148 ^F 103, 171 E/} 169 yZ XML }]Dw} (x) CREATE INDEX od (x) j8E" 151 text() Zc 104 UNIQUE X|Voe 147 XML {FUd 140 XMLEXISTS =JC> 94 XQuery #=mo= 130 S\ XMLGROUP /} 426 XMLROW /} 432 f]T }]`M 385 li} 317 LL JOoO 459 Pm 459 Jb7( 459 pureXML 459 ek XML D5 21 i/ XML }] 24 4( DB2 }]bMm 20 T XML }]4(w} 20 Ev 19 |B XML D5 22 >} XML D5 23 9C XSLT xPd; 29 i$ XML D5 27 Zc j6 14 cNa9 14 X4 14 &m8n hv 14 Ev 10, 12 `M5 15 tT 11, 13 D5 hv 12 *X 12 V{.5 15 comment hv 14 text hv 13 w} 467 ZcDj6 14 ZcDcNa9 14 ZcD`M5 15 ZcDV{.5 15 a{/ XML 100 bv T= CLI &CLr 219 XML 39 ~= CLI &CLr 219 XML 39 2, SQL Z Perl P;\'V 245 [K] IvTDUq XML i$ 47 Uq XML bv 39 XMLVALIDATE &m 47 UV{. x"MD XML #=Vb 368 [L] }L wC Java &CLrPD XML N} 234 (CoTKP1 XML }]`M'V 250 b? XML }]`M'V 250 T\ 261 COBOL XML }]`M'V 250 C/C++ XML }]`M'V 250 Java XML }]`M'V 250 XML 'V 289 ,S=((Perl DBI) 244 P w}| 151 [M] {FUd 9C XSLT xP|D 122 |n DECOMPOSE XML DOCUMENT 326 UPDATE XMLSCHEMA 451 |nP&mw(CLP) "a XSR Ts 187 XML 15 #= f"b 185 [N] Z? XML `k =8 290 JDBC 289 SQLJ 289 XML }]Ddk 288 .NET 289 Z*M SQL /} 248 [Q] 6k= SQL &CLr XML 5 225 ?F`M*; j8E" 72 XML 5 XMLQUERY >} 71 [S] OBD=h 139 yw 461 XMLNAMESPACES 429 9C XQuery |B XML }] 180 >} deregisterDB2XMLObject 188 registerDB2XMLSchema 188 XML Vb +;,OBDPD`v53dA%vm 383 +3dA%vmD`v5xPVi 381 P> 373 3dA XML P 376 53dA%vm 377, 378 53dA`vm 380 }] ek XML 37, 38, 219 }]bVx pureXML T\ 275 XML T\ 275 }]b\mUd(DMS) pureXML }]f"T\ 286 XML T\ 286 }]`M XML VbDf]T 385 Ev 3 468 pureXML 8O }]`M (x) XQuery ?F`M*; 72 }]#M XQuery M XPath 8 }]F/ XML 202 tTZc 13 w} | yZ XML }]D XQuery #=mo= 130 ,S=JD?F`M*;fr 106 XML ;xVs!4DQw 133 /} 133, 135, 137 /}mo==h 139 OBD=h 139 0k}]1"zms 209 fn:exists 135 fn:starts-with 137 XMLEXISTS =JC> 94 [T] unMu~ vfo 460 [W] =J XMLEXISTS 95 D>Zc hv 13 D>Qw T XML }]xP+D>Qw 109 D5 Ev 453 9CunMu~ 460 !"f 453 PDF D~ 453 D5Zc j8E" 12 D53r 14 Jb7( LL 459 ICDE" 459 XML Vb 390 [X] T= XML bv 39 T\ }L (i 261 XML 275, 288 rP hv 9 rP/ }]*; 290 T= Ev 115 CLI &CLr 220 ~= Ev 115 CLI &CLr 218, 220 CCSID A`k{F3d 309, 408 XML D5PDnp 127 rPPDn 9 [Y] i$ XML }] Vb 367 j8E" 47 QywY1m XML }] j8E" 279 ~= XML bv 39 }C`M ?F`M*; 72 E/} 258 XQuery >} 258 CDATA ?V 367 CLI &CLr XML }] 218 SQL/XML /} 218 XML }] ek 219 &m 218 |D1!`M 221 |B 219 lw 220 XQuery mo= 218 CLI/ODBC dCX|V MapXMLCDefault 221 MapXMLDescribe 221 COMPLETE XMLSCHEMA |n 448 CREATE INDEX od yZ XML }]Dw}>} 169 j8E" 151 C# .NET XML >} 254 D DB2 E"PD f> 456 |B 456, 457 DB2 XQuery /} xmlcolumn 62 db2-fn:sqlquery /} 99 DB2::DB2 }/Lr pureXML 'V 241 DDL od Dd XSR Ts 190 DECOMPOSE XML DOCUMENT |n 326 DECOMP_CONTENT X|V 365 DECOMP_DOCUMENTID X|V 365 DECOMP_ELEMENTID X|V 365 deregisterDB2XMLObject =( 188 E ErrorLog XML #= 54, 55 EXPLAIN od XML 'V 15 I IBM Data Server Driver for JDBC and SQLJ XML 'V 235 IBM Data Studio XML 'V 15 ibm_db2 API j8E" 240 IMPORT |n XB4(yZ XML }]Dw} 150 J Java }L }/Lr 251 JDBC }L >}(XML M XQuery 'V) 251 XML >} 251 }]`k 289 L LOAD 5CLr XML }] 208, 209 N Net Search Extender +D>Qw XML }] 109 NULL SQL 5 Vb 368 P pdo_ibm j8E" 240 Perl =( O*,S 244 ,S 244 ,SA}]b 244 ^F 245 pureXML 'V 241 PHP TZ IBM }]~qwD)9 240 lw XML }] 241 470 pureXML 8O PHP (x) D5 241 BX 241 &CLr*" 240 pureXML Ev 1 DB2::DB2 }/Lr 241 R REGISTER XMLSCHEMA |n 446 REGISTER XSROBJECT |n 449 registerDB2XMLSchema =( 188 REORG INDEX |n XB4(yZ XML }]Dw} 150 REORG TABLE |n XB4(yZ XML }]Dw} 150 S SQL +i/ N}+] 99 k XQuery dO9C 99 SQL /} `kM 248 Z*M 248 CZN}Md?D XML }]`M 247 SQL od oz T> 455 +N}+]A XQuery mo= 97 CREATE INDEX 151 SQLJ XML }] 289 SQL/XML /} XMLQUERY Ev 69 XMLTABLE Ev 82 U UDT ?F`M*; 72 UPDATE XMLSCHEMA |n 451 V Visual Explain XML 'V 15 X xdbDecompXML }L 323 XDB_DECOMP_XML_FROM_QUERY }L 327 XDM,kND XQuery M XPath }]#M 8 XML >z XML }]f" 1 `LoT'V 217 d; XSLTRANSFORM 117, 119, 121, 126 ;xVs!4DQw 133 N} S Java LrwC}L 234 }L 245 Xv 247 d5 247 %"w 45 4(m 37 f" `k{FA CCSID 3d 298, 397 y>mPf" 33 D5np 127 XML f"Ts 33 "} mP 113 #?5 111 %vm 112 `vm 113 \a 111 XQuery 114 4F'V 17 Ev 1 $_ 15 9l >}(mP) 113 >}(#?5) 111 >}(%vm) 112 >}(`vm) 113 >}(\a) 111 >}(XQuery) 114 XbV{&m 114 SQL/XML " 267 }LPDd? 245 /}w} 133, 135, 137 li} XML D5 23 9C XSLT xPd; 29 i$ XML D5 27 bv bvms 51 j8E" 39 CLI &CLr 219 XSR_GET_PARSING_DIAGNOSTICS f"}L 50 Ii5}]`M 35 *O'V 17 {FUd 67 6W 88 +D>Qw 109 yw Ev 287 6k= SQL &CLr 221 9C fn:exists Dw} 135 9C fn:starts-with Di/ 137 B~"<'V 17 dv=( 3 dk=( 3 }]j{T 43 DB 17 ^F 393 T\ Ev 275, 288 rP/ j8E" 115 CLI &CLr 218, 220 i$ 47 y> \m 267 &CLr*" 269 \a 266 &CLr*" Ev 217 y> 269 COBOL &CLr 223 CREATE INDEX od 151 C/C++ &CLr 4P XQuery mo= 223 developerWorks DB 17 IBM Data Server Driver for JDBC and SQLJ 235 SQL/XML /} "< 110 XMLQUERY Ev 69 XMLTABLE Ev 82 XML #=f"b (XSR) 185 XMLQUERY /} 225 XQuery mo= 223, 225 XSR Ts Ev 185 XML `k TZ}]*;D0l 290 =8 Z?`k}]Ddk 290 9CT=rP/lw 295 9C~=rP/lw 293 b?`k}]Ddk 292 G Unicode 56 Ev 221, 287 lw XML }] 288 Z? 287 Z}LN}P+] XML }] 289 JDBC &CLr 289 SQLJ &CLr 289 XML }]Ddk 288 .NET &CLr 289 XML Vb ]iD5 318 Ev 315 JOoO 390 X|V 365 }L 315 P/ 373 KTm 369 a{ 366 {C 322 U5 368 UV{. 368 #= ]i 318 9l 372 tC 316 "a 316 tC#= 316 >} +;,OBDPD`v53dA%vm 383 +3dA%vmD`v5xPVi 381 P> 373 3dA XML P 376 53dA%vmazz%vP 377 53dA%vmazz`vP 378 53dA`vm 380 DECOMPOSE XML DOCUMENTS |n 317 }]`Mf]T SQL `M 385 ^F 389 \zD4S`M 369 i$'{ 367 Ec 315 "a#= 316 "M Ev 330 #= 391 8( 330 \a 331 wCr 330 472 pureXML 8O XML Vb (x) "M (x) db2-xdb:column 340 db2-xdb:condition 348 db2-xdb:contentHandling 351 db2-xdb:defaultSQLSchema 332 db2-xdb:expression 345 db2-xdb:locationPath 342 db2-xdb:normalization 355 db2-xdb:order 358 db2-xdb:rowSet 333 db2-xdb:rowSetMapping 361 db2-xdb:rowSetOperationOrder 364 db2-xdb:table 338 db2-xdb:truncate 359 CDATA ?V 367 xdbDecompXML }L 323 XDB_DECOMP_XML_FROM_QUERY }L 327 XML 9l mP 113 #?5 111 %vm 112 `vm 113 /} 110 >}Pm 111 XbV{&m 114 XQuery 114 XML P ek 37, 38 (e 37 |B 179 li 9.1 .0DM'z 109 *O53 17 mS 38 6L}]4 17 XML }]`M 3 XML #= }% 188 f"b "a 185 9lTVb 372 yZ XML }]Dw} 146 lw 200 P>"aD 199 tCTVb 316 ]x =8 198 }L 190 f]T*s 190 >} 198 i$ 47 "a 188 "aTVb 316 i~lw 200 XML #=f"b (XSR) Ts Dd 190 Ev 185 (}f"}L"a 186 (}|nP&mw"a 187 Vb 316 Ev 185 #=lw 200 3;J4j6(URI);CN< 185 i$ 47 ADD XMLSCHEMA DOCUMENT |n 447 COMPLETE XMLSCHEMA |n 448 REGISTER XMLSCHEMA |n 446 REGISTER XSROBJECT |n 449 UPDATE XMLSCHEMA |n 451 XML }] `k G Unicode 56 Ev 287 {FA CCSID 3d 298, 397 CCSID A`k{F 309, 408 ek Ev 37 j8E" 38 i/ #?MN}jG+] 97 +]P{ 98 =( 64 Ev 61, 63 XMLEXISTS =J 93 XMLQUERY /} 69, 70 XMLTABLE /} 82, 84, 85 i/M XPath }]#M 203 4(m 37 f"Z}]bP Ts 33 Ev 33 y>mP 33 } 184 F/ 201, 202 QywY1m 279 E/mPf" 33 *s 34 XML f"Ts 33 f"Mlw.sDnp 127 ]i&m 88 Vb 315 |B 183 Ii5}]`M 35 {FUd 67 mSA}]b Ev 37 P 38 XML {FUd 65 XML #=lw 200 XML D5P*X.dDX5 86 XML D5P*X.dDX5 86 XML i$ bvms 51 XSR_GET_PARSING_DIAGNOSTICS f"}L 50 XMLAGG [//} "< XML 110 j8E" 413 XMLATTRIBUTES j?/} "< XML 110 j8E" 414 xmlcolumn /} 62 XMLCOMMENT j?/} "< XML 110 j8E" 416 XMLCONCAT j?/} 416 XMLDOCUMENT j?/} "< XML 110 j8E" 417 XMLELEMENT j?/} "< XML 110 j8E" 418 XMLEXISTS /} 64 XMLEXISTS =J i/== +]N}jG 97 +]#? 97 +]P{ 98 Ev 93 `M*; 97 j8E" 95 XMLFOREST j?/} "< XML 110 j8E" 424 xmlFormat tT ~xF XML q= 226 XMLGROUP j?/} 426 XMLGROUP [//} "< XML 110 XMLNAMESPACES yw "< XML 110 j8E" 429 XMLPARSE j?/} bvEv 39 XMLPI j?/} "< XML 110 j8E" 431 XMLQUERY j?/} i/== +]N}jG 97 +]#? 97 +]P{ 98 Ev 69 a{ GUrP 69 UrP 70 ?F`M*;*G XML `M 71 j8E" 80 XMLQUERY /} 64 XMLROW j?/} "< XML 110 474 pureXML 8O XMLROW j?/} (x) j8E" 432 XMLSERIALIZE j?/} rP/Ev 115 XMLTABLE m/} i/== 98 Ev 82 >} ek5XD5 84 &m`vw 86 &mVc}] 88 T3nD?v5}5X;P 85 j8E" 89 XMLTABLE /} 64 XMLTEXT j?/} "< XML 110 j8E" 433 XMLVALIDATE j?/} i$Ev 47 XPath ]i&m 88 XQuery S SQL wC 64 Ev 61 |Bmo= 180 E/} 119, 121, 122 ^F 126 XSLTRANSFORM j?/} "< XML 110 j8E" 435 XSR Ts "a 185 XSR_ADDSCHEMADOC }L 440 XSR_COMPLETE }L 441 XSR_DTD }L 442 XSR_EXTENTITY }L 443 XSR_GET_PARSING_DIAGNOSTICS f"}L bv XML bvMi$ms 51 dvN} XML #= 54, 55 j8E" 50 XSR_REGISTER }L 439 XSR_UPDATE }L 444 [XpV{] .NET +2oTKP1 (CLR) }L >} 254 w} 475 476 pureXML 8O  Printed in China S151-1775-01 Spine information: IBM DB2 10.1 for Linux, UNIX, and Windows pureXML 8O 

还剩488页未读

继续阅读

pdf贡献者

yulewo123

贡献于2016-11-07

下载需要 10 金币 [金币充值 ]
亲,您也可以通过 分享原创pdf 来获得金币奖励!