Solved

Getting Exponential values when insertinbg to database

Posted on 2004-03-28
11
337 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In  today’s increasingly digital world, managed service providers (MSPs) fight for their customers’ attention, looking for ways to make them stay and purchase more services. One way to encourage that behavior is to develop a dependable brand of prod…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

758 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

18 Experts available now in Live!

Get 1:1 Help Now