dbTalk Databases Forums  

Size of datatype NUMBER

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Size of datatype NUMBER in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Norbert Pürringer
 
Posts: n/a

Default Size of datatype NUMBER - 02-25-2009 , 07:25 AM






Hello,

what is the size of the Oracle datatype NUMBER in bytes?

Thank you,
Norbert

Reply With Quote
  #2  
Old   
gym dot scuba dot kennedy at gmail
 
Posts: n/a

Default Re: Size of datatype NUMBER - 02-25-2009 , 08:56 AM







"Norbert Pürringer" <thalion77 (AT) graffiti (DOT) net> wrote

Quote:
Hello,

what is the size of the Oracle datatype NUMBER in bytes?

Thank you,
Norbert
It depends on the number. It can be as large as 22 bytes. In Oracle numbers
are stores in base 100 so a good approximation is logbase10(the number)/2 +1
.. Numbers are internally expressed in scientific notation so 1,000,000,000
isn't much larger than 10 in terms of storage. You can be empirical about
it using vsize eg select vsize(mynumbercolumn) from mytable;




Reply With Quote
  #3  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Size of datatype NUMBER - 02-25-2009 , 09:09 AM



On Feb 25, 8:25*am, Norbert Pürringer <thalio... (AT) graffiti (DOT) net> wrote:
Quote:
Hello,

what is the size of the Oracle datatype NUMBER in bytes?

Thank you,
Norbert

At
http://download.oracle.com/docs/cd/B...1.htm#sthref81
the manual states:
<q>
NUMBER Datatype

The NUMBER datatype stores zero as well as positive and negative fixed
numbers with absolute values from 1.0 x 10^-130 to (but not including)
1.0 x 10^126. If you specify an arithmetic expression whose value has
an absolute value greater than or equal to 1.0 x 10^126, then Oracle
returns an error. Each NUMBER value requires from 1 to 22 bytes.
</q>

If you don't specify the precision when declaring the column, then the
default is the max, 22bytes.

Reading the manual is a great way to answer these questions for
yourself.
Ed


Reply With Quote
  #4  
Old   
Mark D Powell
 
Posts: n/a

Default Re: Size of datatype NUMBER - 02-25-2009 , 02:54 PM



On Feb 25, 9:56*am, "gym dot scuba dot kennedy at gmail"
<kenned... (AT) verizon (DOT) net> wrote:
Quote:
"Norbert Pürringer" <thalio... (AT) graffiti (DOT) net> wrote in message

news:35dce30e-e971-4d23-97e3-bd0e07c18177 (AT) v15g2000yqn (DOT) googlegroups.com...> Hello,

what is the size of the Oracle datatype NUMBER in bytes?

Thank you,
Norbert

It depends on the number. *It can be as large as 22 bytes. In Oracle numbers
are stores in base 100 so a good approximation is logbase10(the number)/2+1
. *Numbers are internally expressed in scientific notation so 1,000,000,000
isn't much larger than 10 in terms of storage. *You can be empirical about
it using vsize eg select vsize(mynumbercolumn) from mytable;
I have always just used the formula published by Oracle to approximate
the internal storage needed for a numeric value: round((( length((p)
+ s) / 2)) + 1 where s = 0 for a positive number and 1 for a negative
number

Note that powers of 10, that is, 100, 1000, 10000, 1000000 etc just
need to increase the exponent.

HTH -- Mark D Powell --


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.