Concatenation of multiple columns to a single column

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
AnushaReddy
Participant
Posts: 13
Joined: Thu Dec 02, 2010 2:55 am

Concatenation of multiple columns to a single column

Post by AnushaReddy »

Hi all,

I have 5 columns with varchar datatype in the oracle database .
I need to read those 5 columns and need to generate 3 columns.
The example how to generate 3 columns is mentioned below

example :
Input:
C1,C2,C3,C4,C5 are there columns in the database.

Output:

C1 , C2 , C3C4C5

Third column is nothing but concatenation of C3,C4 and C5 columns.

My concerns during concatenation i should keep the length of the field also in mind.Incase if the value of the coulmn is less than maximum length then i need to pad spaces in the right.

Padding the spaces can be done in the transformer.Any easy way to pad spaces to the unused bytes.

Table 1: datatype is varchar2(3)
C1 C2 C3 C4 C5
1 2 3 4 5

Output:

F1 F2 F3
1 2 3 4 5 (ie.,after 3 two spacea and the same way for 4 and 5 also)

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

Post by ray.wurlod »

Use a Column Export stage.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
AnushaReddy
Participant
Posts: 13
Joined: Thu Dec 02, 2010 2:55 am

Post by AnushaReddy »

Ya i have tried to do using Column export stage but padding the space was not happenning
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Use CHAR columns rather than VARCHAR columns. That or explicitly pad them yourself using Right().
-craig

"You can never have too many knives" -- Logan Nine Fingers
adityavinay
Participant
Posts: 32
Joined: Tue Dec 13, 2011 7:27 am

Re: Concatenation of multiple columns to a single column

Post by adityavinay »

As Craig suggested use Char datatype and make sure your $APT_STRING_PADCHAR is set to space(0x20).
Post Reply