加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Oracle data type number

发布时间:2020-12-12 14:47:57 所属栏目:百科 来源:网络整理
导读:Oracle number NUMBER [ (p [,s]) ] Number having precision p and scale s. Theprecision p can range from 1 to 38. The scale s can range from -84 to 127. Bothprecision and scale are in decimal digits. A NUMBER value requires from 1 to 22bytes

Oracle number

NUMBER [ (p [,s]) ]

Number having precision p and scale s. Theprecision p can range from 1 to 38. The scale s can range from -84 to 127. Bothprecision and scale are in decimal digits. A NUMBER value requires from 1 to 22bytes.

scale是可选的。

SQL> drop tablet_number purge;

Table dropped

SQL> create tablet_number(id number(5),id1 number(5,3));

Table created

SQL> insert intot_number values(10000.8999999999999999999999299988888888888889,10.003);

1 row inserted

SQL> insert intot_number values(10000.8999999999999999999999299988888888888889,10.0034);

1 row inserted

SQL> --insert intot_number values(10000.8999999999999999999999299988888888888889,100.003); --报错

SQL> commit;

Commit complete

SQL> select * fromt_number;

IDID1

------ -------

1000110.003

1000110.003

OracleNUMBER的定义:

1、只有一个参数时,如NUMBER(24)。表示所定义的数字最大可设置24位整数。

2、有两个参数时,如NUMBER(38,3)。表示所定义的数字最大是38位长,其中包含3位小数。就是说这个类型最大可设置35位整数和3位小数。

3小数位超出长度会进行四舍五入,整数位超出长度报错

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读