Solved

Getting Exponential values when insertinbg to database

Posted on 2004-03-28
11
338 Views
Last Modified: 2010-08-05
I am using JSP deployed on Tomcat with Oracle 8i as database. My problem is when i insert a large value(say 10 digits)  using JSP in my database it gets inserted as something like 4.8E9
I am usin Double datatype in JSP and the width of column in Oracle is also defined as NUMBER(20,2).
0
Comment
Question by:anna_1980
  • 4
  • 3
  • 2
  • +1
11 Comments
 
LVL 7

Expert Comment

by:searlas
ID: 10702387
What are you using to view the Oracle values?  Have you tried reading the values back out of Oracle using JDBC?
Basic question, is this actually a problem, or is it just the appearance of the number that concerns you?
0
 
LVL 6

Expert Comment

by:jarasa
ID: 10702610
Try using Float.
Javier
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 10705534
follow what other experts have suggested. if you have problem on displaying value in web page, then your might also want to look into java.text.DecimalFormat
0
 

Author Comment

by:anna_1980
ID: 10710494
>>What are you using to view the Oracle values?  Have you tried reading the values back out of Oracle using JDBC?
Basic question, is this actually a problem, or is it just the appearance of the number that concerns you?

--Yes, I am using JDBC and fetching the values back using ResultSet.  
This is indeed a problem because users don't like it that way.


>>Try using Float.

--Tried that.Infact I started with using Float but then switched to Double thinking it may solve the problem.



0
 
LVL 14

Accepted Solution

by:
kennethxu earned 150 total points
ID: 10710576
then, you indeed need java.text.DecimalFormat

java.text.DecimalFormat df = new java.text.DecimalFormat( "#,###0.00" );
...
double amount = rs.getDouble( "column_name" );

...
<p>amount: <%=df.format( amount )%></p>
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 6

Expert Comment

by:jarasa
ID: 10711738
Can you post you code to see if is something starnge on it?
Javier
0
 

Author Comment

by:anna_1980
ID: 10711763
Thanks everyone for helping
0
 
LVL 7

Expert Comment

by:searlas
ID: 10711983
Gotta acknowledge kennethxu's expreience here; avoiding the trap of taking the problem description as gospel, seeing through it, and solving the actual problem... (presentation of numbers on screen, NOT in the database)

0
 
LVL 6

Expert Comment

by:jarasa
ID: 10712064
Doesn't he got the Points??

:c)

Javier

P.D.: I agree Searlas.
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 10715825
you guys are making fun on me :-)
I would like to pass some points but just afraid somebody in the forum will again starts crying. Missing those days that can enjoy a peaceful forum with you guys.
0
 
LVL 6

Expert Comment

by:jarasa
ID: 10721927
Hmm as I see it, points mean nothing here* , well is good that EE has given us unlimited points to ask I appeciate that even while I don't ask much, but what I really miss is a place to talk and get to know each other a bit better.

I really enjoy helping ppl here and that's becose we can make a laugh from time to time :c))

Javier

* To tell the truth I like to see my name on the list :cP
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
In 2017, ransomware will become so virulent and widespread that if you aren’t a victim yourself, you will know someone who is.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now