Vertical pivot

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
just4u_sharath
Premium Member
Premium Member
Posts: 236
Joined: Sun Apr 01, 2007 7:41 am
Location: Michigan

Vertical pivot

Post by just4u_sharath »

Hello,
I have a scenario where the number of rows for the each key column is differs. I need to convert these rows in to columns. Max number of rows i get for each key column is 3.

Example
TCN, SEQ_NUM, VALUE
0321 001 BK
0321 002 BF

My out put should be

TCN, SEQ_NUM_1, SEQ_NUM_2, SEQ_NUM_3, VALUE_1, VALUE_2,VALUE_3
0321, 001, 002,'',BK,BF,''

I am using pivot vertical stage but its works correctly i have 3 rows but less than 3 it fails, because the out put columns from pivot stage is by default not null..

Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Make the output columns nullable for the Pivot stage (it generates NULL for non-existing input), and deal with the nullability downstream.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply