Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Kapil.

Asked: June 12, 2018 - 6:46 am UTC

Last updated: June 16, 2018 - 1:15 am UTC

Version: 11.2.0.4.0

Viewed 1000+ times

You Asked

Hi Tom,
Hope you are good.

I have a requirement where I need to display rows as columns. Suppose there are 2 rows with 4 columns each then the result should display 2*4 i.e, 8 columns. Is it possible just using SQL?

Thanks


and Connor said...

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

What if Values are not known to you

Kapil Mittal, June 15, 2018 - 4:57 am UTC

Hi Tom,

What I understood from the link shared by you, it will work if you already know the values. How can we do it if we don't know the values.
Connor McDonald
June 15, 2018 - 6:32 am UTC

Then you probably need to resort to code. Stew Ashton has a nice routine for that here

https://stewashton.wordpress.com/2018/05/30/improved-pivot-function/

Thank You !

Kapil Mittal, June 15, 2018 - 8:12 am UTC

Thanks a lot.
Connor McDonald
June 16, 2018 - 1:15 am UTC

glad we could help

More to Explore

SQL

The Oracle documentation contains a complete SQL reference.