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

前端 未结 6 1941
傲寒
傲寒 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:25

    According to Oracle Documentation:

    Scale can be greater than precision, most commonly when e notation is used. When scale is greater than precision, the precision specifies the maximum number of significant digits to the right of the decimal point. For example, a column defined as NUMBER(4,5) requires a zero for the first digit after the decimal point and rounds all values past the fifth digit after the decimal point.

    It is good practice to specify the scale and precision of a fixed-point number column for extra integrity checking on input. Specifying scale and precision does not force all values to a fixed length. If a value exceeds the precision, then Oracle returns an error. If a value exceeds the scale, then Oracle rounds it.

提交回复
热议问题