number blues

From: Anand <hsanand13_at_yahoo.com>
Date: Sun, 22 Jul 2001 06:56:26 GMT
Message-ID: <8324cc14.0107042204.770be9ff_at_posting.google.com>


I noticed a peculiar thing in Oracle
recently. This is regarding the size of the NUMBER datatype.
Normally, if i create a table like the one below,

CREATE TABLE test
(ID NUMBER(7,2));
I mean that that the ID column can hold a number which is maximum 7 digits long, out of which 2 digits are for decimals.

Now, the way I understand it, 7 has to be the SCALE
(the total length) and 2 has to be the PRECISION (the
decimal part).

But Oracle says that PRECISION VALUES CAN BE BETWEEN 1 - 38 ONLY!
and SCALE VALUE CAN BE BETWEEN 1- 127.

As per the above explanation, 7 becomes the precision and 2 becomes the scale!(*** THIS ZAPS ME ***)

Which also means that If i write
CREATE TABLE test
(ID NUMBER(39));
I will get an error.
(I tried and got one!

"ERROR at line 2:
ORA-01727: numeric precision specifier is out of range
(1 to 38)" )

So please correct me if I am wrong here. I cannot define a column which can hold more than 38 digits???!!!???

NOW COMES THE BIGGER PROBLEM!
If I do not specify the size of the number column while creating the table,(I even tried this one!), I am able to insert an number which is 126 digits in size!!!!!

CAN YOU HELP ME DEMYSTIFY THIS ONE! Thanks in advance. Received on Sun Jul 22 2001 - 08:56:26 CEST

Original text of this message