Page 1 of 1

First Character of source to First char of target

Posted: Wed Jun 14, 2006 6:34 am
by rafidwh
Hi All,
My source is a flatfile and target is an OCI,my scenario is I have source column srcCol and corresponding target column TrgCol1

SrcCol1 (Datatype - Char(1)) is moved to column TrgCol1 (Datatype - Char(2))of table .
So srcCol1 should be moved to the first character of column TrgCol1

If I have Data like
srcCol1 -A then the it should populate in Trgcol1 as "A_ " not as "_ A"

I mean source column value should go to the first charcter of the target column not to the second character.

Will The Datastage implicitly take the value in the first character itself or should I need to explicitly put the value only in the first character.

Please suggest

Regards,
Saik

Posted: Wed Jun 14, 2006 6:38 am
by ArndW
You are going from CHAR(1) to CHAR(2). Use explicit padding of one space in your derivation. The derivation for TrgCol1 is

Code: Select all

SrcCol1:' '

Posted: Wed Jun 14, 2006 6:40 am
by rafidwh
Thankyou Arndw

Re: First Character of source to First char of target

Posted: Wed Jun 14, 2006 6:42 am
by rwierdsm
Saik,

I think this is really more of a display issue in whatever tool is used to access the data in Oracle.

However, if you wish to have the data left justified instead of right justified in the Oracle column, just concatenate a blank to your input column, i.e. TrgCol1 = SrcCol1 : ' '

Hope this helps,

Rob W.

Posted: Wed Jun 14, 2006 6:46 am
by chulett
ArndW wrote:You are going from CHAR(1) to CHAR(2). Use explicit padding of one space in your derivation...
Isn't that... completely unnecessary? Since when will char fields be right justified? Just map one to the other, no extra who-ha needed. :?

Posted: Wed Jun 14, 2006 7:22 am
by ArndW
You are right, in 99% of the cases this is unnecessary as the implicit padding will be right when going to a VarChar from CHAR. But sometimes the default pad character might not be set to space - so in this type of scenario I'd always opt for the explicit method. I am thinking more of PX jobs than server ones at the moment for this padding question, though.