Click here to Skip to main content
15,896,437 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Everyone,

I need one solution to prevent automatic rounding of number in oracle. Here I am explaining what I want.Please go through this flow.

SQL> create table dm_demo(no number(23,9));

Table created

SQL> insert into dm_demo values (9999999.999999999);

1 row inserted

SQL> select * from dm_demo;

NO
-------------------------
10000000.000000000

Now if i use to_char() then it will show me the correct figure. But the thing is I don't want to use to_char().

SQL> select to_char(no) from dm_demo;

TO_CHAR(NO)
----------------------------------------
9999999.999999999



Please help me out to accomplish this task and Please let me know if you have some other solutions. Thank You.
Posted
Updated 12-Mar-15 18:49pm
v2
Comments
Jörgen Andersson 13-Mar-15 7:10am    
It's not Oracle, the program you're using for presenting the results is using Double internally.
Tell us how you're using the data that gets rounded.
Member 10500506 14-Mar-15 3:32am    
I am not using any program. I am using Oracle's SQL Plus to Execute this Query.
Jörgen Andersson 14-Mar-15 7:18am    
Well that's also a program, but Oracle, so there is a solution.

As Tom Kyte says[^]: "
SQLPlus has a default number format is uses to display data on the screen "nicely".  You need to
either

o set the numformat to something you like
o use a TO_CHAR on the number with a format that applies in your case.


Info on how to set Numformat here[^].
 
Share this answer
 
in oracle to display a numbers after the decimal point we use the concept of precision in the number datatype.check about it
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900