Oracle number数据类型介绍

来源:互联网 发布:淘宝店铺装修图片素材 编辑:程序博客网 时间:2024/05/16 10:17
number类型存储值的范围为1.0 x 10-130 到 1.0 x 10126(不含)。


每个number占用1-22bytes的存储空间。


NUMBER(p,s)
p is the precision, 最大有效的十进制位数,Oracle guarantees the portability of numbers with precision of up to 20 base-100 digits,
 which is equivalent to 39 or 40 decimal digits depending on the position of the decimal point.
 
s is the scale,指定小数点右边的位数,The scale can range from -84 to 127.如果是负值,比如是-2,相当于round到百分位。

如果s>p,p指的是小数点右边的有效位数,s指的是小数点右边的所有位数。

NUMBER(p)等同于NUMBER(p,0)。


NUMBER,什么都不指定,所有的取值范围。