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 your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
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.
Dig Deeper on Oracle database design and architecture
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.