Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: NUMERIC data type always takes up 22 bytes. Alternatives?
[Sorry if you see this message twice. I sent it to another forum]
Hi, Tom,
Your dump file says you actually executed
insert into test_numbers values (111,111111,111111111111);
but you said the middle number is 11111, five digits.
Back to the original question. It's not true when you create a NUMBER datatype, it always takes 22 (or 38 whatever) bytes. Dumping the datafile for this purpose is an overkill. Take Tom's example, you can simply select vsize(a), vsize(b), vsize(c) from test_numbers and see they take 3, 4, 7 bytes, respetively.
But Steve Adams once said it's a good habit to explicitly specify the precision (and scale) instead of simply say NUMBER. I can't remember the exact reason.
Yong Huang
yong321_at_yahoo.com
Tom Pall wrote:
I create a table: create table test_numbers (a number, b number, c number);
I insert into the table
insert into test_numbers values (111,11111,111111111111);
1 row inserted
I commit
Then I dump the first data block after the header, see that I am storing
data_block_dump
flag=--------- ntab=1 nrow=1 frre=-1 fsbo=0x14 fseo=0x1fa4 avsp=0x1f90 tosp=0x1f90 0xe:pti[0] nrow=1 offs=0 0x12:pri[0] offs=0x1fa4
col 0: [ 3] c2 02 0c col 1: [ 4] c3 0c 0c 0c col 2: [ 7] c6 0c 0c 0c 0c 0c 0c
![]() |
![]() |