How many bytes are reserved for column type NUMBER(63)?

How many bytes does Oracle reserve for a column of type NUMBER(63) (defined as REAL in my PRO C program) where this column has values of 1 or 0 only? I have a table with column type NUMBER(63) and we are thinking of changing the type to CHAR(1) to save space!

How many bytes does Oracle reserve for a column of type NUMBER(63) (defined as REAL in my PRO C program) where this column has values of 1 or 0 only? I have a table with column type NUMBER(63) and we are thinking of changing the type to CHAR(1) to save space!

Oracle will use up to 38 bytes to store a NUMBER datatype. However, if Oracle can use less bytes to store the number,...

By submitting my Email address I confirm that I have read and accepted the Terms of Use and Declaration of Consent.

By submitting your personal information, you agree that TechTarget and its partners may contact you regarding relevant content, products and special offers.

You also agree that your personal information may be transferred and processed in the United States, and that you have read and agree to the Terms of Use and the Privacy Policy.

it will. The minimum number of bytes for the NUMBER datatype is two, as Oracle has to store the exponent and the mantissa of the value.

The CHAR(1) datatype specification will require one byte of storage, assuming that you are using a single-byte characterset. A multi-byte characterset will require more bytes. So while changing from NUMBER to CHAR(1) will save one byte of storage space, I have to ask is it really worth the effort? Saving one byte here or there is really not worth the effort required to implement that change, in my opinion. And I tend to stick with the adage that numbers should be stored in NUMBER datatypes and strings in CHAR or VARCHAR2 datatypes. For numeric values, the NUMBER datatype will ensure that you have the appropriate precision. To store only a 1 or a 0, I would use the NUMBER(1,0) datatype.

0 comments

Register

Login

Forgot your password?

Your password has been sent to:

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy