This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes getDouble() not returning correct data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "getDouble() not returning correct data" Watch "getDouble() not returning correct data" New topic
Author

getDouble() not returning correct data

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Hi. I have a column in a table that has data that is defined as Numeric(6,4).
In my java app, all I am trying to do is print this data to std out. When I get the information from the db, I do a getDouble() to retrieve it, and I am getting a result of 1.0E-4 ?? The actual value in the db is .0001. Why isn't this returning .0001?
If I run the SQL statement and don't go through the app, it returns .0001.
What am I doing wrong?
Thanks for any help.
Matthew Vincent
Greenhorn

Joined: May 01, 2003
Posts: 8
Just use the following code snippet to help you. Assuming that your variable is called myVal...

Matt
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817

Just for the record, 1.0E-4 is .0001, in case anyone missed that.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getDouble() not returning correct data
 
Similar Threads
problem in retrieving data from excel
Bitwise
java.sql.SQLException: No data read
Strange query results using Java, but OK w/SQLSVR Mgmt Studio
Data file format from new assignment