| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Number vs Number(x)
Storage for number(p,s) is about 1 + floor(p/2) + 1 [+1] in Oracle Conceptual Manual.
So number allows for 38 precision 1+ 19 + 1 = 21 bytes. 22 ( if negative)
number(3) alows for only 3. 1+ 1 + 1 = 3 4( if negative )
Jun
Thomas Kyte wrote:
> On Tue, 9 Dec 1997 14:21:44 GMT, Douglas Scott
> <Douglas.S.Scott_at_boeing.com>
> wrote:
>
> >If you are defining a field in a table that will contain integer data
is
> >it better to define the field with respect to its associated length
(if
> >max value will be 999 then define field as NUMBER(3)) or to
generically
> >define it as NUMBER?
> >
> >Douglas Scott
> >Douglas.S.Scott_at_boeing.com
>
> Performance wise, storage wise it will have not have an impact if you
> use NUMBER
> or NUMBER(3).
>
> Application wise, it will make a big difference. NUMBER(3) is similar
> to
> creating a table like:
>
> create table T1
> ( x number check ( round(x) between -999 and 999 ) )
>
> with a trigger:
>
> ...
> begin
> :new.x := round(:new.x);
> end;
> ...
>
> The number(3) will behave like a constraint and a rule, it will
> - force the value of X to be between -999 and 999 and
> - to be 3 digits (inserting the value 1.5 into a number(3) returns 2).
>
> If that fact is important to your application, or you wish to capture
> into the
> data dictionary the fact that the total number of digits is three and
> it
> contains no decimal points, then use NUMBER(3).....
>
>
> Thomas Kyte
> tkyte_at_us.oracle.com
> Oracle Government
> Bethesda MD
>
> http://govt.us.oracle.com/ -- downloadable utilities
>
> -----------------------------
> ----------------------------------------------
> Opinions are mine and do not necessarily reflect those of Oracle
> Corporation
>
> Anti-Anti Spam Msg: if you want an answer emailed to you,
> you have to make it easy to get email to you. Any bounced
> email will be treated the same way i treat SPAM-- I delete it.
Received on Tue Dec 09 1997 - 00:00:00 CST
![]() |
![]() |