×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Birgitta,
Thanks for your great example. I appreciate you providing a direct answer to my question. I must admit I share Jon's thoughts about SQL, but that is mostly due to my lack of use. I would definitely be interested in taking one of your classes. Would that be through COMMON, or RPG/DB2 Summit?
subject: RE: Creating XML document via SQL - Db2 for i 7.2
Hi Jim,
that is not as difficult.
You split your SQL-Statement into multiple Common Table Expressions that construct the XML components. These CTEs are joined together and for building the next component until the XML document is completed in the Final Select.
Look at the following XML document:
<Request>
<Product>
ProductA
<Profile>
ProfileA
<Data>
<Field1>Field1A</Field1>
<Field2>2018-03-10</Field2>
</Data>
<NewGroup>
<Field3>10,56</Field3>
<Field4>Field4A</Field4>
</NewGroup>
</Profile>
</Product>
<Product>
ProductB
<Profile>
ProfileB
<Data>
<Field1>Field1B</Field1>
<Field2>2018-03-09</Field2>
</Data>
<NewGroup>
<Field3>125,20</Field3>
<Field4>Field4B</Field4>
</NewGroup>
</Profile>
</Product>
</Request>
This XML Document is generated by the following SQL-Statement With x as (Select *
From (Values('ProductA', 'ProfileA', 'Field1A', Current_Date,
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok) "What is worse than training your staff and losing them? Not training them and keeping them!"
?Train people well enough so they can leave, treat them well enough so they don't want to.? (Richard Branson)
As an Amazon Associate we earn from qualifying purchases.
This thread ...
RE: Creating XML document via SQL - Db2 for i 7.2, (continued)
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.