Page 1 of 1

Concatenation of multiple columns to a single column

Posted: Fri May 03, 2013 5:05 am
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

Posted: Fri May 03, 2013 5:25 am
by ray.wurlod
Use a Column Export stage.

Posted: Fri May 03, 2013 5:46 am
by AnushaReddy
Ya i have tried to do using Column export stage but padding the space was not happenning

Posted: Fri May 03, 2013 7:13 am
by chulett
Use CHAR columns rather than VARCHAR columns. That or explicitly pad them yourself using Right().

Re: Concatenation of multiple columns to a single column

Posted: Mon May 06, 2013 8:07 am
by adityavinay
As Craig suggested use Char datatype and make sure your $APT_STRING_PADCHAR is set to space(0x20).