Learn XQuery |
Home:Learn XQuery:XQuery Tutorial:Querying XML Columns :Appendix Appendix: Creating the Sample DataWe used the following methods to insert the XML data into the XML column named XMLCOL using the example data shipped with DataDirect XQuery®. DB2 CREATE TABLE HOLDINGSXML (userid varchar(50) not null primary key,
XMLCOL DB2XML.XMLCLOB NOT LOGGED)
INSERT INTO HOLDINGSXML
(SELECT
h.USERID,
xml2clob(XMLELEMENT(name "HOLDINGS",
XMLAGG(
XMLELEMENT(name "SHARE",
XMLATTRIBUTES(s.COMPANYNAME AS COMPANY,h.USERID AS USERID),
h.SHARES))))
FROM HOLDINGS h, STATISTICAL s
WHERE h.STOCKTICKER = s.TICKER
GROUP BY h.USERID)
Oracle CREATE TABLE HOLDINGSXML(userid varchar2(50) primary key, XMLCOL XMLTYPE)
INSERT INTO HOLDINGSXML
(SELECT
h.USERID,
XMLELEMENT("HOLDINGS",
XMLAGG(
XMLELEMENT("SHARE",
XMLATTRIBUTES(s.COMPANYNAME AS COMPANY,h.USERID AS USERID),
h.SHARES)))
FROM HOLDINGS h, STATISTICAL s
WHERE h.STOCKTICKER = s.TICKER
GROUP BY h.USERID)
|
Try DataDirect XQuery® Free!Put the power, scalability, and performance of DataDirect XQuery® to work for you today! Our free trial lets you see for yourself how easy it is to build data integration applications that access relational, EDI, and other file formats as XML! Online Video Tutorials!Our easy-to-follow online video tutorials are a great way to get acquainted with the many features of DataDirect XQuery®. And if you like what you see, download a free copy today and try DataDirect XQuery® for yourself! Stay Informed!XQuery is one of the hottest XML technologies being developed today. Stay informed with vital news about standards, tools, and trends by signing up for the DataDirect XQuery® newsletter. |





