Home » SQL & PL/SQL » SQL & PL/SQL » Cents corrupted on large number (Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production)
Cents corrupted on large number [message #684355] Tue, 18 May 2021 03:26 Go to next message
Buchas
Messages: 101
Registered: March 2006
Senior Member
Hello,

I insert into table one value, but when select, I get another value. Is it Oracle bug, or am I missing something?

SQL> create table test15(num number(17,2));

Table created


SQL> insert into test15 (num)values(123456789012345.12);

1 row inserted


SQL> commit;

Commit complete


SQL> select * from test15;

                NUM
-------------------
 123456789012345,01
As you see I inserted value with .12 decimal part, but when selecting, I get .01
Why the numbers do not match?
Re: Cents corrupted on large number [message #684356 is a reply to message #684355] Tue, 18 May 2021 03:36 Go to previous messageGo to next message
Michel Cadot
Messages: 68658
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

It works for me:
SQL> create table test15(num number(17,2));

Table created.

SQL> insert into test15 (num)values(123456789012345.12);

1 row created.

SQL> commit;

Commit complete.

SQL> set numwidth 20
SQL> select * from test15;
                 NUM
--------------------
  123456789012345.12

1 row selected.

SQL> @v

Oracle version: 12.1.0.2.190716 EE
Please post the result of:
select to_char(num,'999999999999990.00') from test15;
Re: Cents corrupted on large number [message #684357 is a reply to message #684356] Tue, 18 May 2021 04:13 Go to previous message
Buchas
Messages: 101
Registered: March 2006
Senior Member
It seems there is some problem with PL/SQL Developer, as using to_char shows correct value for me:

SQL> select num from test15;

                NUM
-------------------
 123456789012345,01

SQL> select to_char(num) from test15;

TO_CHAR(NUM)
----------------------------------------
123456789012345.12
OK, I can live with that, thanks.
Previous Topic: Timezone Europe/Paris
Next Topic: SUM of parent and child records
Goto Forum:
  


Current Time: Tue May 28 22:08:46 CDT 2024