Page 1 of 1

Decimal Datatype

Posted: Thu Feb 27, 2014 5:01 am
by AnushaReddy
Hi,

There is a oracle table which has below column

"DEP_ID" Decimal(22,5)

But while reading data from the table using datastage i have declared metadata in the "ORACLE CONNECTOR" as Decimal(22,2)

My concern is will it just truncate the rest of the decimal part or will it round off?

Data in the table " 23.56789"

When read using datastage will it be 23.56 or 23.57

Posted: Thu Feb 27, 2014 5:41 am
by anbu
Why dont you run the job and see the result?

Posted: Thu Feb 27, 2014 6:10 am
by priyadarshikunal
there is a environment variable for that, have a look.

why not read the value as it is and then round or truncate as your job logic. This gives you more control over the data.

Posted: Thu Feb 27, 2014 6:11 am
by AnushaReddy
I am able to see the data is being round off to the nearest value.
So need help to prevent this.

Input : 123.448

Output as per data stage job : 123.45

Output expected is : 123.44

Posted: Thu Feb 27, 2014 6:18 am
by anbu
Use oracle function trunc

Code: Select all

TRUNC(123.448, 2)
2 is the number of decimal places to truncate to

Posted: Thu Feb 27, 2014 7:47 am
by chulett
Or select it with the proper scale and then use DecimalToDecimal() within the job to truncate it during the conversion to the lower scale.

Posted: Thu Feb 27, 2014 2:14 pm
by ray.wurlod
Learn about the rtype option that goes with these conversion functions to specify how you want the value to be rounded.