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!

SQL query for making the horizontally stored data to vertical format

694068Jun 30 2009 — edited Jun 30 2009
HI i have a table named table1 and columns and data as below like below

table1

Main sub1 sub2 sub3 sub4 sub5 sub6
A L1 T1
B L1 T1
C L2 T2 K1 T1
D L2 T2 K1 T1

Basically the data is stored in horizontal above.i want a query to make the data in vertical like below

A T1
A L1
B T1
B L1
C T1
C K1
C T2
C L2
D T1
D K1
D T2
D L2


Aslo even if the values come in sub5 and sub6 the query should handle and populate the values vertically and also if a new row added also.

Thanks a lot in advance
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 28 2009
Added on Jun 30 2009
17 comments
5,210 views