How can an Oracle NUMBER have a Scale larger than the Precision?

前端 未结 6 1962
傲寒
傲寒 2021-01-12 17:39

The documentation states: \"Precision can range from 1 to 38. Scale can range from -84 to 127\".

How can the scale be larger than the precision? Shouldn\'t the Scal

6条回答
  •  鱼传尺愫
    2021-01-12 18:20

    Thanks to everyone for the answers. It looks like the precision is the number of significant digits.

     select cast(0.000123 as number(2,5)) from dual
    

    results in:

    .00012
    

    Where

     select cast(0.00123 as number(2,5)) from dual
    

    and

     select cast(0.000999 as number(2,5)) from dual
    

    both result in:

    ORA-01438: value larger than specified precision allowed for this column
    

    the 2nd one due to rounding.

提交回复
热议问题