string to Decimal conversion

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
vij
Participant
Posts: 131
Joined: Fri Nov 17, 2006 12:43 am

string to Decimal conversion

Post by vij »

hi all,

I have an issue after i convert string to decimal..

this is the derivation for the column which is of decimal 5 as length and precision as 1, "if condtn then (stringtodecimal(column1[4,2])) else null" .

i dont understand how i can get a value 0490.0, for the input 000490.
It has a space as the first character in the output. how can it store a character (space) in a decimal field?

pls help me in solving this..
mpouet
Participant
Posts: 34
Joined: Mon Oct 18, 2004 10:23 am
Location: France

Re: string to Decimal conversion

Post by mpouet »

Hi alone,

The first character is reserved for the sign... For example -0490.0.
This is not a problem with ODBC connection nether OCI plug in. If you store this decimal in a sequential file, use a CHAR/VARCHAR type.

Matthieu.
richdhan
Premium Member
Premium Member
Posts: 364
Joined: Thu Feb 12, 2004 12:24 am

Post by richdhan »

Hi,

Even I have faced some weird issues with StringtoDecimal Conversion.

Just trim the string before doing the conversion.

HTH
--Rich
Post Reply