Converting Rows to Columns

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
balu536
Premium Member
Premium Member
Posts: 103
Joined: Tue Dec 02, 2008 5:01 am

Converting Rows to Columns

Post by balu536 »

Hi all,
I have a requirement to convert the rows present in a source table to Columns.
For ex:
Id Name Value
1 Jhon 3
1 Sam 5
2 Serena 1
2 William 7
2 Jose 9
3 Paul 5
3 Fedy 4

and the required output is

**1st record**
Id Jhon Sam
1 3 5

**2nd record**
Id Serena William Jose
2 1 7 9

**3rd record**
Id Paul Feddy
3 5 4

The data in the target is very huge(Around 80 million).
I cant implement this logic in SQL query and extract it from Oracle stage in datsatge as for each Id the Columns are differing and also the data is huge.

Please explain me the procedure how to implement the same in datastage without degrading the perfomance.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's a vertical pivot. Since you have no other way of doing it, there's no danger of degrading performance because you don't have any "performance".

Search for "vertical pivot".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
balu536
Premium Member
Premium Member
Posts: 103
Joined: Tue Dec 02, 2008 5:01 am

Post by balu536 »

Will you please explain how to acheive the Vertical Pivot logic using the Datastage.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

balu356 - Ray suggested you use the Search to find the many threads that deal with this question of vertical pivoting. If you search those threads and don't find the information you are seeking then please ask on this thread.
balu536
Premium Member
Premium Member
Posts: 103
Joined: Tue Dec 02, 2008 5:01 am

Post by balu536 »

I've searched using the Vertical Pivot literal but there were many threads,where everyone is replying to search for the topic as it was already discussed many times,but i couldn't really find one which solves my logic.I found a solution where the number of records per key are fixed but that's not the case with me.Please provide me the link to the Original thread where the Vertical Pivot is done for Dynamic rows(i.e no specific count of rows for a particular Key)

Regards,
Balakrishna
balu536
Premium Member
Premium Member
Posts: 103
Joined: Tue Dec 02, 2008 5:01 am

Post by balu536 »

I've searched using the Vertical Pivot literal but there were many threads,where everyone is replying to search for the topic as it was already discussed many times,but i couldn't really find one which solves my logic.I found a solution where the number of records per key are fixed but that's not the case with me.Please provide me the link to the Original thread where the Vertical Pivot is done for Dynamic rows(i.e no specific count of rows for a particular Key)

Regards,
Balakrishna
laknar
Participant
Posts: 162
Joined: Thu Apr 26, 2007 5:59 am
Location: Chennai

Post by laknar »

Post Reply