Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: How is NUMBER datatype stored ?
On Tue, 02 May 2000 17:10:05 GMT, stanley.shapiro_at_wcom.com wrote:
>How many bytes are used for the NUMBER datatype ?
>IBI's FOCUS is translating NUMBER as an 8-byte double precision value.
>I am getting weird results, but I don't know if it's related to wrong
>assumptions about the actual stored length.
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Courtesy of Oracle :
Oracle stores values of the NUMBER datatype in a variable-length format. The first byte is the exponent and is followed by 1 to 20 mantissa bytes. The high-order bit of the exponent byte is the sign bit; it is set for positive numbers. The lower 7 bits represent the exponent, which is a base-100 digit with an offset of 65.
Each mantissa byte is a base-100 digit, in the range 1..100. For positive numbers, the digit has 1 added to it. So, the mantissa digit for the value 5 is 6. For negative numbers, instead of adding 1, the digit is subtracted from 101. So, the mantissa digit for the number -5 is 96 (101-5). Negative numbers have a byte containing 102 appended to the data bytes. However, negative numbers that have 20 mantissa bytes do not have the trailing 102 byte. Because the mantissa digits are stored in base 100, each byte can represent 2 decimal digits. The mantissa is normalized; leading zeroes are not stored.
Up to 20 data bytes can represent the mantissa. However, only 19 are guaranteed to be accurate. The 19 data bytes, each representing a base-100 digit, yield a maximum precision of 38 digits for an Oracle NUMBER. Paul Received on Tue May 02 2000 - 00:00:00 CDT
![]() |
![]() |