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: Tom Pall <tom_at_cdproc.com>
Date: Sat, 21 Oct 2000 19:26:38 -0500
Message-Id: <10656.119915@fatcity.com>


The dump is hex. Numbers are stored in Oracle in a rather strange format. The 11111 got stored, with exponent and mantissa, in 4 bytes.

> [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.
> http://im.yahoo.com/
> --
> Please see the official ORACLE-L FAQ: http://www.orafaq.com
> --
> Author: yong huang
> INET: yong321_at_yahoo.com
>
> Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
> San Diego, California -- Public Internet access / Mailing Lists
> --------------------------------------------------------------------
> To REMOVE yourself from this mailing list, send an E-Mail message
> to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
> the message BODY, include a line containing: UNSUB ORACLE-L
> (or the name of mailing list you want to be removed from). You may
Received on Sat Oct 21 2000 - 19:26:38 CDT

Original text of this message

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