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

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

    The question could be why not ? Try the following SQL.

    select cast(0.0001 as number(2,5)) num, 
           to_char(cast(0.0001 as number(2,5))) cnum,
           dump(cast(0.0001 as number(2,5))) dmp
      from dual
    

    What you see is that you can hold small numbers is that sort of structure It might not be required very often, but I'm sure somewhere there is someone who is storing very precise but very small numbers.

提交回复
热议问题