Skip to Main Content

SQL & PL/SQL

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!

how to create XML tree when sql query return multiple rows

user649990Nov 16 2016 — edited Nov 17 2016

I have table( tab1) which join 2 table called tab2 which can return multiple row. I also join to tab3 which return only unique row

select col1,col2,col3 from tab1 left join tabl2 on tab.col1=tab2.col2 left join tab3 on tab3.col1=tab1.col1

I need a result in XML format

<JOB>

<col1>1<col1>

<tab2>

<col2>1<\col2>

<col3>2<\col3>

<\tab2>

<tab2>

<col2>4<\col2>

<col3>5<\col3>

<\tab2>

<\JOB>

is there any way i can do this in sql

pls let me know if you need more info

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 15 2016
Added on Nov 16 2016
3 comments
1,271 views