Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Select DISTINCT attribute vlaues fom XMLTYPE column and...

kozandJun 22 2011 — edited Jul 4 2011
Hello
I have spent whole day to find the solution with no success. PLEAS HELP !
The Problem :
1. I have table with xmlType column in this column is the following xml:
<revision>
<product id = 1>
<screw>
<img id = 1/>
</screw>
<screw>
<img id = 2/>
</screw>
</product>
<product id = 2>
<screw>
<img id = 1/>
</screw>
</product>
</revision>

I must select DISTINCT img IDs and then select/join them form relational table img (id(number), pic (blob) )

I can't find the solution to select distinct attribute values from XML!

I have tried this:


select extract(c.xml, 'revision/product/screw/img[not(@id=preceding-sibling::img/@id)]/@id') from TABLE c;
This post has been answered by odie_63 on Jun 22 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 1 2011
Added on Jun 22 2011
7 comments
2,581 views