Oracle data type number
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.8999999999999999999×××99988888888888889,10.003);
1 row inserted
SQL> insert intot_number values(10000.8999999999999999999×××99988888888888889,10.0034);
1 row inserted
SQL> --insert intot_number values(10000.8999999999999999999×××99988888888888889,100.003); --報(bào)錯(cuò)
SQL> commit;
Commit complete
SQL> select * fromt_number;
??? ID????ID1
------ -------
?10001?10.003
?10001?10.003
?
在Oracle中NUMBER的定義:
1、只有一個(gè)參數(shù)時(shí),如NUMBER(24)。表示所定義的數(shù)字最大可設(shè)置24位整數(shù)。
2、有兩個(gè)參數(shù)時(shí),如NUMBER(38,3)。表示所定義的數(shù)字最大是38位長(zhǎng),其中包含3位小數(shù)。就是說(shuō)這個(gè)類(lèi)型最大可設(shè)置35位整數(shù)和3位小數(shù)。
3、小數(shù)位超出長(zhǎng)度會(huì)進(jìn)行四舍五入,整數(shù)位超出長(zhǎng)度報(bào)錯(cuò)。
轉(zhuǎn)載于:https://blog.51cto.com/90sirdb/1940538
總結(jié)
以上是生活随笔為你收集整理的Oracle data type number的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: [Leedcode][JAVA][第11
- 下一篇: pdf如何解除限制转换为word