Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: NUMERIC data type always takes up 22 bytes. Alternatives?

Re: NUMERIC data type always takes up 22 bytes. Alternatives?

From: yong huang <yong321_at_yahoo.com>
Date: Sat, 21 Oct 2000 10:16:47 -0700 (PDT)
Message-Id: <10656.119909@fatcity.com>


[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



tsiz: 0x1fb8
hsiz: 0x14
pbl: 0x0107b164
bdba: 0x02401765
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

block_row_dump:
tab 0, row 0, @0x1fa4
tl: 20 fb: --H-FL-- lb: 0x1 cc: 3
col  0: [ 3]  c2 02 0c
col  1: [ 4]  c3 0c 0c 0c
col  2: [ 7]  c6 0c 0c 0c 0c 0c 0c

end_of_block_dump
End dump data blocks tsn: 6 file#: 9 minblk 5989 maxblk 5989

Do You Yahoo!?
Yahoo! Messenger - Talk while you surf! It's FREE. Received on Sat Oct 21 2000 - 12:16:47 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US