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
srini.dw
Premium Member
Premium Member
Posts: 186
Joined: Fri Aug 18, 2006 1:59 am
Location: Chennai

String to Decimal conversion

Post by srini.dw »

Source file has varchar2(20) but target table has Decimal(20,6).How to convert varchar2 to decimal.i tried using StringToDecimal() function.But output coming as all ZERO's.Target values as 00000000000000.000000

Please suggest your thoughts on this ....
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You use the StringToDecimal() function. Show us your syntax and some samples of the incoming data. Also, are you saying that you always get zeroes regardless of the original string value?
-craig

"You can never have too many knives" -- Logan Nine Fingers
srini.dw
Premium Member
Premium Member
Posts: 186
Joined: Fri Aug 18, 2006 1:59 am
Location: Chennai

Post by srini.dw »

Using function as StringToDecimal(lkGeidAdded.OVERRIDE_BALANCE_UNITS,6)

Input values 20.5 , 5.5.....but output coming as 00000000000000.000000
jwiles
Premium Member
Premium Member
Posts: 1274
Joined: Sun Nov 14, 2004 8:50 pm
Contact:

Post by jwiles »

StringToDecimal(lkGeidAdded.OVERRIDE_BALANCE_UNITS,6)
Why do you include ",6" in your StringToDecimal() function call? This optional second parameter of the function is a string which indicates the type of rounding to be performed during the conversion, as documented here. This may likely be the cause of your problem.

Regards,
- james wiles


All generalizations are false, including this one - Mark Twain.
Post Reply