Number Precision in Oracle

 

Some people have the impression that setting a precision on number fields affects storage. To be clear, we’re talking about the difference between these two column definitions.

CREATE TABLE example (amount NUMBER);
CREATE TABLE example (amount NUMBER(10));

Actually there is no difference except that attempting to insert a number that’s too large into the second will throw an error. From http://ss64.com/ora/syntax-datatypes.html, “Oracle stores all numeric data in variable length format – storage space is therefore dependent on the length of all the individual values stored in the table. Precision and scale settings do not affect storage requirements.” An example of this is proven at http://fredericktang.wordpress.com/2008/07/10/size-of-number/.

 Posted by at 9:17 pm

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)