Page 1 of 1

How to pad leading zero to string

Posted: Tue Dec 23, 2008 8:20 am
by nirdesh2
Hi,

My source data is 123 and datatype is varchar2 and length is 10
I want to store it as 0000000123 in the target data with datatype varchar2 and length 10.

Posted: Tue Dec 23, 2008 9:04 am
by LenGreenwood
In a Transformer derivation expression, you could try:

Code: Select all

("0000000000":link.col)[10]
That is, you prepend 10 zeroes to the start of your data, then substring the right-most 10 characters.

Syntax is the same in both Server and Parallel jobs.

Posted: Tue Dec 23, 2008 9:15 am
by chulett
Basically the same technique with a different function:

Code: Select all

Right("0000000000" : link.col, 10)
:wink: