Showing posts with label scale. Show all posts
Showing posts with label scale. Show all posts

November 10, 2009

NUMBER Datatype - Scale greater than Precision

Number(p,s) is one of the numeric datatypes available in Oracle.
Where p is the precision and s is the scale.
For example, number(7,2) is a number that has 5 digits before the decimal and 2 digits after the decimal -> 12345.67

You can specify a scale that is greater than precision, although it is uncommon.
In this case,
  1. Only digit before the decimal point is 0 (zero)
  2. Scale s specifies the maximum number of digits to the right of the decimal point
  3. Scale-Precision s-p specifies the minimum number of zeros present after the decimal point
For example, number(2,7) can store 0.0000012.
Maximum number of digits to the right of the decimal point is 7
Minimum number of zeros present after the decimal point is 7-2=5