Select statement on NUMBER fields - round number?

Romci

Member
Hi,

I am having problem when displaying numbers from a table.
I found out that when a field is of type number(x,y) and x is greater than 15, the numbers don't show correctly in plsql developer.

Here is an example and a test sample:

create table TEST_NUMBER(n NUMBER(20,3));

insert into test_number
(n)
values
(12345678911234567.123);

select n, to_char(n) from TEST_NUMBER t;

The select statement displayes:
1 12345678911234600,000 12345678911234567,123

If we look at the first number, plsql developer "rounded" the number, the second number is shown correctly using to_char function.

I found that there is an option in plsql developer that always uses to_char function on number fields (Tools - > Preferences -> "SQL Window" -> "Number fields to_char"), but I don't think that this is the correct step in solving this issue. Correct me if I am wrong.
 
This is indeed a floating point precision limitation. The "Number fields to_char" option is the right way to go if you need more precision.
 
Back
Top