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!

Pivot a Single Row of Data

3234063May 7 2016 — edited May 8 2016

I need to know how to pivot a single row of data.

I have a select statement that will always returns a single row of data with about 100 columns. I need to return instead a single column that has 100 rows. It is critical that I have the rows returned in an order controllable by the column names.

with t as (select 'a' as c1, 'x' as c2, 'm' as c3, 'w' as c4 from dual)

select * from t

I need to produce the following:

a

x

m

w

The following is NOT acceptable

a

m

w

x

Thanks,

Scott

This post has been answered by Solomon Yakobson on May 8 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 5 2016
Added on May 7 2016
6 comments
2,036 views