VARchar2나 varchar같은 경우는 VARchar2(30)하면 30byte 차지하잖아요!!
그런데 NUMBER(11)이면 11byte 차지하는 것 맞나여??
Float(126) 이 4byte가 맞나여??
혼돈되서 질문 드립니다.
by 문동섭
[2008.07.11 16:50:14]
오라클 11g 공식 문서의 내용입니다. 참고하세요.
Internal Numeric Format
Oracle stores numeric data in variable-length format. Each value is stored in scientific notation, with 1 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 102, with 1 byte used to store the exponent(2) and 2 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.
Zero and positive and negative infinity (only generated on import from Version 5 Oracle databases) are stored using unique representations. Zero and negative infinity each require 1 byte; positive infinity requires 2 bytes.