Solved

Getting Exponential values when insertinbg to database

Posted on 2004-03-28
11
344 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

The recent Petya-like ransomware attack served a big blow to hundreds of banks, corporations and government offices The Acronis blog takes a closer look at this damaging worm to see what’s behind it – and offers up tips on how you can safeguard your…
OnPage enhanced its integration with ConnectWise Manage to offer incident responders more control over the ticket and Incident Resolution Lifecycle.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

630 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