Page 1 of 1

Comma to Decimal Point Substitution

Posted: Sat Nov 04, 2006 6:09 am
by asitagrawal
Hi Friends,

In my database, the Decimal values use comma(,) instead of deciaml points (.).
The values when read in DataStage hence treated as String (e.g -15,89 which actualy is -15.89).

How do I convert the comma into decimal??

Thx.

Re: Comma to Decimal Point Substitution

Posted: Sat Nov 04, 2006 6:21 am
by swarnkar
[quote="asitagrawal"]Hi Friends,

In my database, the Decimal values use comma(,) instead of deciaml points (.).
The values when read in DataStage hence treated as String (e.g -15,89 which actualy is -15.89).


Hi Asit,

You can use following function

Ereplace(Arg1,char(44),char(46))

Arg1 is the field name it will return the desired values.

Posted: Sat Nov 04, 2006 6:33 am
by ray.wurlod
I believe you'll find that no decimal placeholder character is stored at all; it is applied when extracting decimal data from the database. The fact that it is a comma suggests that you are in a European locale.

If you are running DataStage with NLS enabled, you can set your locale differently.

The answer posted by swarnkar will work, too, because inside DataStage there are no data types; your decimal number can be treated as a string. Convert() is a more efficient function than Ereplace() for this task, however.

But are "." characters really correct? Just because they're what you want, why is it that the owner of the data chooses to represent them as comma? Is it because that's the naturally expected representation there? In your position I'd check that before unilaterally converting to ".".