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: numberic column size

Re: numberic column size

From: Andreas Necker <Andreas.Necker_at_isb-ka.de>
Date: Fri, 02 Mar 2001 13:28:46 +0100
Message-ID: <3A9F91FE.2264B979@isb-ka.de>

hi,

Jun FAN wrote:
>
> Hi all,
>
> I was told that in Oracle the number(n) type column will occupy exactly the
> same number of n bytes, say number(6) will occupy 6 bytes and number(10,2)
> will be 10. Is it true? I can't find any hint in the oracle documents.
>
> Thanks for any explanation.
>
> Regards

Concepts Manual:


Internal Numeric Format

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. The resulting value is limited to 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). Negative numbers include the sign in their length.

Taking this into account, the column size in bytes for a particular numeric data value NUMBER (p), where p is the precision of a given value, can be calculated using the following formula:

ROUND((length(p)+s)/2))+1

where s equals zero if the number is positive and s equals 1 if the number is negative.

-- 
Andreas Necker

ISB AG              Tel: +49 (0)721/82800-0
Karlstrasse 52-54   Fax: +49 (0)721/82800-82
76133 Karlsruhe     mailto:Andreas.Necker_at_isb-ka.de
Germany             http://www.isb-ka.de
Received on Fri Mar 02 2001 - 06:28:46 CST

Original text of this message

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