Page 1 of 1

String to Decimal conversion

Posted: Fri Mar 29, 2013 10:44 am
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 ....

Posted: Fri Mar 29, 2013 10:52 am
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?

Posted: Sat Mar 30, 2013 12:03 am
by srini.dw
Using function as StringToDecimal(lkGeidAdded.OVERRIDE_BALANCE_UNITS,6)

Input values 20.5 , 5.5.....but output coming as 00000000000000.000000

Posted: Sat Mar 30, 2013 10:12 am
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,