This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JDBC and the fly likes 2 decimal points VS 1 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "2 decimal points VS 1 " Watch "2 decimal points VS 1 " New topic
Author

2 decimal points VS 1

Ronald Whalen
Ranch Hand

Joined: Mar 27, 2001
Posts: 38
Hi,
Ran into a problem. I am using mySQL as DB. In one table I have 2 different decimals defined in the following way in the schema:
VAR1 DECIMAL(3,1)
VAR2 DECIMAL(5,2)
they are both stored correctly in the DB. Upon retrieval they are both pulled into float primitive vars. The VAR1 appears correctly ( if stored as 8.0 the primitive float value = 8.0) however, the VAR2 appears incorrectly (if stored as 8.00 it appears as 800.0. The code to pull them out of the resultset is identical, naturally different float primitive vars.)
Any help or comments would be appreciated.

thanks,

Ronald Whalen
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 2 decimal points VS 1