dbTalk Databases Forums  

XML joining Nested resultsets

comp.databases.oracle comp.databases.oracle


Discuss XML joining Nested resultsets in the comp.databases.oracle forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
ccote_msl@yahoo.com
 
Posts: n/a

Default XML joining Nested resultsets - 03-15-2005 , 03:58 AM






HI, I have an XMLType column that has the following XML structure:


<Client>
<Report id = "01">
<Item id = "01" Description = ",a.mdfbnelt;yuk" </Item>
<Item id = "02" Description = "AAAAA;yuk" </Item>
<Item id = "03" Description = "XXXXX" </Item>
</Report>
<Report id = "02">
<Item id = "01" Description = ",ABCDEF" </Item>
<Item id = "02" Description = "JHIKLM" </Item>
<Item id = "03" Description = "OPQRST" </Item>
</Report>
</Client>


I would like to extract and insert data into the following file


Table MyTable(Client, Report_id, Item_id, Description)


So I created the following query
SELECT
extractValue(VALUE(x), '/Client/@id')) Client,
extractValue(VALUE(d), '/Report/@id') Report,
extractValue(VALUE(e), '/Item/@id') Description,
extractValue(VALUE(e), '/Item/@Description) Description
FROM XMLDOC2 x,
TABLE(xmlsequence(extract(VALU*E(x), '/Client/Report'))) d,
TABLE(xmlsequence(extract(VALU*E(x), '/Client/Report/Item'))) e


But I get the cartesian product of the reports and the items. I would
like to get the items related to a reports AND the report id on the
same line. If it is not possible, I would like to filter out the items
belonging to report; some kind of where clause.


Anybody has an idea?


Thank you,
CCote


Reply


Reply With Quote
  #2  
Old   
GreyBeard
 
Posts: n/a

Default Re: XML joining Nested resultsets - 03-15-2005 , 06:57 AM







http://groups.google.ca/groups?hl=en...66%40gmail.com

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.