Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: numberic column size
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.deReceived on Fri Mar 02 2001 - 06:28:46 CST
![]() |
![]() |