Reputation: 5
My Question is simple, I would like to display rows as column:
Eg: Student
Name Age
----------
John 10
Paul 20
Smith 25
Display information as below :
John Paul Smith
------------------
10 20 25
I have read about Decode
Function, but same is not flexible.
Upvotes: 0
Views: 623
Reputation: 18808
To make the final result set dynamic ( you dont' know how many columns you'll need to pivot on ), you need to generate the query and then open a ref cursor for it.
Take a look at this link and the code listing 2 in that..
http://www.oracle.com/technetwork/issue-archive/2012/12-jul/o42asktom-1653097.html
Upvotes: 1