If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Db2 Bigdecimal to Real conversion error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-12-03, 11:53
sselvakumar72 sselvakumar72 is offline
Registered User
 
Join Date: May 2003
Posts: 16
Db2 Bigdecimal to Real conversion error

Hi All,
I am trying to insert java BigDecimal object into Db2 real column type. This works fine in general. However, when I have a 9 digit number, rounding takes place. For eg, when I am trying to insert 1234567.89 into real type column, the data stored in the db2 column is 1234567.85

Could anyone tell me how to avoid this rounding. The above occurs only for 9 or more digit numbers.

Thanks
Sk
Reply With Quote
  #2 (permalink)  
Old 12-12-03, 13:16
achiola achiola is offline
Registered User
 
Join Date: May 2002
Location: General Deheza, Cba, Arg.
Posts: 273
Re: Db2 Bigdecimal to Real conversion error

Hi,
Where you see this value rounding?
Reply With Quote
  #3 (permalink)  
Old 12-12-03, 13:28
jsander jsander is offline
Registered User
 
Join Date: Apr 2003
Posts: 191
Re: Db2 Bigdecimal to Real conversion error

Hi,

datatype REAL's internal represantation is 4 bytes long. Try to store in DOUBLE instead and you should be fine.

BTW, with REAL I got a loss of accuracy when I went from 7 to 8 digits. So after all, you are not that bad off!

Johann

Quote:
Originally posted by sselvakumar72
Hi All,
I am trying to insert java BigDecimal object into Db2 real column type. This works fine in general. However, when I have a 9 digit number, rounding takes place. For eg, when I am trying to insert 1234567.89 into real type column, the data stored in the db2 column is 1234567.85

Could anyone tell me how to avoid this rounding. The above occurs only for 9 or more digit numbers.

Thanks
Sk
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On