Rounding decimal values

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
ag_ram
Premium Member
Premium Member
Posts: 524
Joined: Wed Feb 28, 2007 3:51 am

Rounding decimal values

Post by ag_ram »

Hi Folks

Source is a decimal(17,4) target is Varchar(50) . values in the decimal input can be negative . In the target leading '0' to be trimmed and 2 decimals are needed after point(.).

For positive integers TRIM does the trick , but stuck up with negative decimals(since start char is a '-' sign) TRIM would not work .

Suggestions appreciated!
balajisr
Charter Member
Charter Member
Posts: 785
Joined: Thu Jul 28, 2005 8:58 am

Post by balajisr »

Can you post your derivation?

Ideally you should be using DecimalToString() with "supress_zero" option. You need not use trim().

What is your rtype when you round the decimal from scale of 4 to 2?
Post Reply