Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: data types
On Fri, 25 Jul 1997 13:49:53 -0700, in comp.databases.oracle.misc you wrote:
I suggest you check out chapter 6 of the Server concepts manual, the NUMBER section. It details how numbers are stored..
>I would appreciate suggestions on the following:
>
>-What is data type number(38) and number(32) what type of data are they good for.
>How many bytes do they take to store data. What range of data can they take.
>
A number(38) can hold a number with 38 total digits. It could hold the number 5, the number 12345678901234567890123456789012345678.
How much space a number(38) takes depends on the number stored in it. Consider:
SQL> create table nums ( x number(38) );
Table created.
SQL> insert into nums values ( 5 );
1 row created.
SQL> insert into nums values ( 12345678901234567890123456789012345678 );
1 row created.
SQL> select x, vsize(x) from nums;
X VSIZE(X)
---------- ----------
5 2 1.2346E+37 20
SQL> So, 5 takes 2 bytes, the really big number takes 20.
A number(32) can hold a number with 32 total digits. (same as number(38) just less digits)
All numbers are stored with significant digits and an exponent.
The ranges are
- positive numbers in the range 1 x 10^–130 to 9.99..9 x 10^125
(with up to 38 significant digits)
>- Are smallint , int valid data types in Oracle
Yes.
SQL> create table nums2 ( x int, y smallint );
Table created.
>
>- To store data that may not go above 32000 what data type would you recommend
>
number. They are all the same, float is number, int is number, smallint is number. Oracle only stored Oracle Numbers regardless of what you refer to them as.
consider the scale and precisions on number more as constraints then anything else. A number(38) can hold any number that a number(5,2) can but a number (5,2) can't hold any number(38) (it can only hold 5 digits, 2 of which are to the right of the decimal place)
Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Bethesda MD
http://govt.us.oracle.com/ -- downloadable utilities
![]() |
![]() |