Page 1 of 1

An additional space is prefixed for the decimal fields

Posted: Wed Dec 24, 2008 4:36 am
by kiranredz
Hi all,

I have a strange problem in my datastage code.

I am reading data from an Oracle Enterprise stage. I have few fields which are defined as Number(38,10). In the DataStage code(oracle stage) these fields are defined as Decimal(8,2). So, i am casting these fields to Number(8,2) in the SQL query using - CAST(FieldName AS NUMBER(8,2)).
Now, when i am reading the data, i am able to see a space preceeding each value. For Ex: If the value for this field in Oracle is 8.75, its read in DS Oracle Ent stage as " 000008.75". And my target data also has this space.

How can i avoid this? Please share with me the soultion if you have.

Thanks,
Kiran

Posted: Wed Dec 24, 2008 6:06 am
by vasa_dxx
Please post the Job design. So that one can find the options in the stages used in job or can suggest a new o be included.
You can rectify it by using trimB() to trim spaces in transformer.

Posted: Wed Dec 24, 2008 6:09 am
by vasa_dxx
have a look at this post for more details.
viewtopic.php?t=124275

Posted: Wed Dec 24, 2008 6:54 am
by kiranredz
vasa_dxx wrote:have a look at this post for more details.
viewtopic.php?t=124275
I found out the reason for that. That space is to display the sign of the number. If its a positive number, we have a space preceeding the number. Ex: 8.54 would be " 000008.54". If its a negative number, the number will be preceeded by a minus(-) sign. Ex: -8.54 would be "-000008.54"