Default Scale value of Number column in Oracle

Viewed 2339

Oracle Docs mentioned that the default precision value is 38 and scale is 0.

If a precision is not specified, the column stores values as given. If no scale is specified, the scale is zero.

But the table mentioned there (Table 26-1) contradicts the statement.

 Input Data   | Specified As  | Stored As  

 7,456,123.89 |  NUMBER       | 7456123.89

If the default scale is 0 (number of digits to the right of the decimal point) then how come the above number is stored with 2 decimal digits. i.e. .89 or have I totally misunderstood the default scale concept?

1 Answers

It might be more helpful to consider four different cases:

  • No precision or scale NUMBER
  • Precision and no scale NUMBER(9)
  • Both precision and scale NUMBER(9,2)
  • Scale only NUMBER(*,2)

The quote ...

If no scale is specified, the scale is zero.

... refers to the second of those, in which a precision but no scale is specified, not the first.

Related