Re: Number type size
Date: Wed, 3 Nov 1993 10:06:01 GMT
Message-ID: <MLOENNRO.93Nov3100601_at_demo1.se.oracle.com>
>>>>> "ASx" == Anthony Sama, x7733 <asama_at_fiji.gesd> writes:
ASx> NNTP-Posting-Host: fiji.motown.ge.com
ASx> Oracle utilizes a maximum of 21 bytes to store Number fields. Are 21 bytes of storage ASx> allocated for each Number field or is the space required dynamically allocated?
Oracle uses up to 22 bytes internally. This is variable length. Use the vsize() function in SQL to see how many bytes each number requires. Most "normal" ID's, order-numbers, phone-number etc require a couple of bytes (2-5).
ASx> Thank You,
ASx> Anthony
Oracle uses a special format for storing numbers internally (in the database): 1st bytes is sign (1 bit) & exponent in base-100 excess-64 notation, followed by a variable number (1-21) of bytes, each containing 2 decimal digits, each representing a base-100 binary number from 0 to 99. The radix point is always to the left of the first digit. Zero is a 1-byte number containing 128, positive infinity is 2 bytes (255,101), and negative infinity is 3 bytes (1,1,102).
The limitations imposed by this variable-length number format are:
Max 38 digits of precision
Max value 9.99E124, that's about
100,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000
The reason we use this format is that all numbers (float and int) can be stored in the same format and collate binary correct.
You would really never use this format externally (in a program), but rather make Oracle convert it into a native numeric type or character string (required precision not available in any compiler I know of).
hope this helps,
Magnus Lonnroth
Oracle Sweden
Received on Wed Nov 03 1993 - 11:06:01 CET