Page 1 of 1

zeros being padded (prefixed) to a decimal field

Posted: Mon Apr 05, 2010 7:10 pm
by vdr123
-Pulled in metadata using orchestrate method in table def

-intiger came in as decimal(38,10)

-when data flows through these fields, its padding zeros(0) in the front.

example: oracle db has intiger 101

DS is reading as "000000000000000101" (lots of zeros)

Any reason this is happening?

Any way to fix this, any APT_ variable to change ? or something to do with fixed width field?(how to declare this or handle this)

This is creating issues with lookup, as its comparing this value to 101 and also writes these zeros to a flat file.

This is happening for all the number fields, so its not good to apply trim or removing leading zeros with functions.

APT_STRING_PADCHAR is 0x0, in the project -- any relavence?

Posted: Mon Apr 05, 2010 8:50 pm
by ray.wurlod
The reason, as you would have learned had you bothered to Search, is that Decimal data types are always displayed to full precision and scale, as a visual guarantee that these are correct.

Posted: Mon Apr 05, 2010 8:58 pm
by vdr123
I did search the forum.

Issue is its writing these zeros to DS, flat file.

When I load this data to oracle db, its fine.

I am doing a CDC using SCD on this data loaded in db and incoming source data.

Will it impact the lookup.

Also, when I write this data to a varchar field, it holds on to zeros.

Is there a way to change the import metadata using orchestrate table def's to a bigint or int, rather than decimal?(without manually changing each one)

Posted: Mon Apr 05, 2010 11:57 pm
by nayanpatra
You can do the lookup in either of the below mentioned ways:

1) You can convert the leading zeros to space, trim the data with varchar datatype and then perform the lookup.

2) You can convert the field which you are looking up into Decimal datatype and then perform the lookup.