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

Home -> Community -> Usenet -> c.d.o.server -> Re: Space allocation for Number datatype

Re: Space allocation for Number datatype

From: <ketanindia_at_hotmail.com>
Date: 1998/03/06
Message-ID: <6dp52o$obt$1@nnrp1.dejanews.com>#1/1

Hi,
Here is a page from Oracle7 Server Concepts Manual. This clearly shows how Oracle stores Numerics and Its storage sizes.

Internal Numeric Format
Datatypes 6–5 Input Data Specified As Stored As

7,456,123.89 NUMBER 7456123.89
7,456,123.89 NUMBER(*,1) 7456123.9
7,456,123.89 NUMBER(9) 7456124
7,456,123.89 NUMBER(9,2) 7456123.89
7,456,123.89 NUMBER(9,1) 7456123.9
7,456,123.89 NUMBER(6) (not accepted, exceeds precision)
7,456,123.89 NUMBER(7,–2) 7456100

Table 6 – 1 How Scale Factors Affect Numeric Data Storage If you specify a negative scale, Oracle rounds the actual data to the specified number of places to the left of the decimal point. For example, specifying (7,–2) means Oracle should round to the nearest hundredths, as shown in Table 6 – 1.
For input and output of numbers, the standard Oracle default decimal character is a period, as in the number “1234.56”. (The decimal is the character that separates the integer and decimal parts of a number.) You can change the default decimal character with the parameter NLS_NUMERIC_CHARACTERS. You can also change it for the duration of a session with the ALTER SESSION statement. To enter numbers that do not use the current default decimal character, use the TO_NUMBER function. Oracle stores numeric data in variable–length format. Each value is stored in scientific notation, with one byte used to store the exponent and up to 20 bytes to store the mantissa. (However, there are only 38 digits of precision.) Oracle does not store leading and trailing zeros. For example, the number 412 is stored in a format similar to 4.12 x 10^2, with one byte used to store the exponent (2) and two bytes used to store the three significant digits of the mantissa (4, 1, 2). Taking this into account, the column data size for a particular numeric data value NUMBER (p), where p is the precision of a given value (scale has no effect), can be calculated using the following formula: 1 byte (exponent)
FLOOR(p/2)+1 bytes (mantissa)
+ 1 byte (only for a negative number where the number of significant digits is
less than 38)

number of bytes of data

THIS IS CHAPTER 6 OF ORACLE7 SERVER CONCEPTS MANUAL. Ketan Shah.

-----== Posted via Deja News, The Leader in Internet Discussion ==----- http://www.dejanews.com/ Now offering spam-free web-based newsreading Received on Fri Mar 06 1998 - 00:00:00 CST

Original text of this message

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