Home » SQL & PL/SQL » SQL & PL/SQL » row to column convert
row to column convert [message #634988] Wed, 18 March 2015 11:56 Go to next message
jaggy
Messages: 15
Registered: November 2014
Location: India
Junior Member
Hi ,
I have a table and the data in one column, I want to convert the records in the table to columns. I tried using decode or case statement but the number of rows(values) is not constant. So I am not able convert all the rows to columns as the no of values are not constant. Can some body please help here?

Source Table:
 source_column
abc
def
ghk
ijk
lmn
opq
|
|


Target Table:
Table b
abc def ghk ijk lmn opq columnx columny - - -
Re: row to column convert [message #634991 is a reply to message #634988] Wed, 18 March 2015 12:43 Go to previous messageGo to next message
hemantakhandare@gmail.com
Messages: 5
Registered: March 2015
Location: Mumbai
Junior Member
Hi.
you can use group by and decode for this.
Re: row to column convert [message #634993 is a reply to message #634991] Wed, 18 March 2015 13:16 Go to previous messageGo to next message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Show us when you don't know the number of rows/columns how you do it.

Re: row to column convert [message #634994 is a reply to message #634988] Wed, 18 March 2015 13:17 Go to previous message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Tell us what is the business need to do so.
What is the purpose of pivoting million of rows to million of columns?

Previous Topic: PRAGMA_INLINE (Overloading)
Next Topic: Optimization ideas in view creation of subselect
Goto Forum:
  


Current Time: Fri Apr 26 04:44:05 CDT 2024