Solved

Getting Exponential values when insertinbg to database

Posted on 2004-03-28
11
341 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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
 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
default methods vs abstract class 1 118
SimpleDateFormat.parse examples 19 99
runtime exception 2 42
jsp error 6 27
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
Building a successful professional career is a long and difficult journey, especially in case if your decisions are not chosen carefully. For example, if you think that you can get to the desired position without experience and apply for it, your ch…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

807 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