Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: NUMBER Vs NUMBER(38)

Re: NUMBER Vs NUMBER(38)

From: Prakash V <venkatprakash_at_hotmail.com>
Date: Mon, 23 Aug 1999 22:16:58 GMT
Message-ID: <19990823221659.80943.qmail@hotmail.com>


If you specify just Number, it is a float. otherwise if you say Number(38) means it is fixed width of 38 digits. Here is more details from Oracle Manual.

Exceprts:
.....

NUMBER Datatype

The NUMBER datatype stores zero, positive and negative fixed and floating-point numbers with magnitudes between 1.0 x 10-130 and 9.9...9 x 10125 (38 nines followed by 88 zeroes) with 38 digits of precision. If you specify an arithmetic expression whose value has a magnitude greater than or equal to 1.0 x 10126, Oracle returns an error.

Specify a fixed-point number using the following form:

NUMBER(p,s)

where:

s

   is the scale, or the number of digits to the right of the decimal point. The scale can range from -84 to 127.

Specify an integer using the following form:

NUMBER(p)

             is a fixed-point number with precision p and scale 0. This is equivalent to NUMBER(p,0).

Specify a floating-point number using the following form:

NUMBER
         is a floating-point number with decimal precision 38. Note that a scale value is not applicable for

         floating-point numbers. (See "Floating-Point Numbers" for more information.)

Scale and Precision

Specify the scale and precision of a fixed-point number column for extra integrity checking on input. Specifying scale and precision does not force all values to a fixed length. If a value exceeds the precision, Oracle returns an error. If a value exceeds the scale, Oracle rounds it.

The following examples show how Oracle stores data using different precisions and scales.

7456123.89

                       NUMBER
                                                   7456123.89
7456123.89
                       NUMBER(9)
                                                   7456124
7456123.89
                       NUMBER(9,2)
                                                   7456123.89
7456123.89
                       NUMBER(9,1)
                                                   7456123.9
7456123.89
                       NUMBER(6)
                                                   exceeds precision
7456123.89
                       NUMBER(7,-2)
                                                   7456100
7456123.89
                       NUMBER(-7,2)
                                                   exceeds precision



Negative Scale

If the scale is negative, the actual data is rounded to the specified number of places to the left of the decimal point. For example, a specification of (10,-2) means to round to hundreds.

Scale Greater than Precision

You can specify a scale that is greater than precision, although it is uncommon. In this case, the precision specifies the maximum number of digits to the right of the decimal point. As with all number datatypes, if the value exceeds the precision, Oracle returns an error message. If the value exceeds the scale, Oracle rounds the value. For example, a column defined as NUMBER(4,5) requires a zero for the first digit after the decimal point and rounds all values past the fifth digit after the decimal point. The following examples show the effects of a scale greater than precision:

Actual Data

                             Specified As
                                                            Stored As
.01234
                             NUMBER(4,5)
                                                            .01234
.00012
                             NUMBER(4,5)
                                                            .00012
.000127
                             NUMBER(4,5)
                                                            .00013
.0000012
                             NUMBER(2,7)
                                                            .0000012
.00000123
                             NUMBER(2,7)
                                                            .0000012



Floating-Point Numbers

Oracle allows you to specify floating-point numbers, which can have a decimal point anywhere from the first to the last digit or can have no decimal point at all. A scale value is not applicable to floating-point numbers, because the number of digits that can appear after the decimal point is not restricted.

You can specify floating-point numbers with the form discussed in "NUMBER Datatype". Oracle also supports the
ANSI datatype FLOAT. You can specify this datatype using one of these syntactic forms:

FLOAT
          specifies a floating-point number with decimal precision 38, or binary precision 126.
FLOAT(b)

          specifies a floating-point number with binary precision b. The precision b can range from 1 to 126. To

          convert from binary to decimal precision, multiply b by 0.30103. To convert from decimal to binary

          precision, multiply the decimal precision by 3.32193. The maximum of 126 digits of binary precision is

          roughly equivalent to 38 digits of decimal precision. .......

Thanks V Prakash

>From: "Nandakumar" <n.kumar_at_rocketmail.com>
>Reply-To: "comp.databases.oracle.misc_at_list.deja.com"
><comp.databases.oracle.misc_at_list.deja.com>
>To: "comp.databases.oracle.misc_at_list.deja.com"
><comp.databases.oracle.misc_at_list.deja.com>
>Subject: NUMBER Vs NUMBER(38)
>Date: Mon, 23 Aug 1999 19:55:55 GMT
>MIME-Version: 1.0
>From errors_at_list.deja.com Mon Aug 23 15:05:29 1999
>Path:
>nntp1.deja.com!nnrp2.deja.com!nntp2.deja.com!nnrp1.deja.com!not-for-mail
>Organization: Deja.com - Share what you know. Learn what you don't.
>Lines: 12
>Message-ID: <7ps905$j8s$1_at_nnrp1.deja.com>
>NNTP-Posting-Host: 209.117.251.206
>X-Article-Creation-Date: Mon Aug 23 19:55:55 1999 GMT
>X-Http-User-Agent: Mozilla/4.51 [en] (WinNT; I)
>X-Http-Proxy: 1.0 x37.deja.com:80 (Squid/1.1.22) for client 209.117.251.206
>X-MyDeja-Info: XMYDJUIDnanban
>Errors-To: errors_at_list.deja.com
>
> Message from the Deja.com forum:
> comp.databases.oracle.misc
> Your subscription is set to individual email delivery
> >
>
>
>Can someone give the difference between the datatype declarations,
>NUMBER and NUMBER(38)?
>
>--
>Nandakumar
>(N.Kumar_at_rocketmail.com)
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.
>
>
>
> _____________________________________________________________
> Deja.com: Share what you know. Learn what you don't.
> http://www.deja.com/
> * To modify or remove your subscription, go to
> http://www.deja.com/edit_sub.xp?group=comp.databases.oracle.misc
> * Read this thread at
> http://www.deja.com/thread/%3C7ps905%24j8s%241%40nnrp1.deja.com%3E
>
>



Get Your Private, Free Email at http://www.hotmail.com

 Sent via Deja.com http://www.deja.com/  Share what you know. Learn what you don't. Received on Mon Aug 23 1999 - 17:16:58 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US