This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases 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


JavaRanch » Java Forums » Databases » JDBC and Relational Databases
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’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: 2 decimal points VS 1
 
It's not a secret anymore!