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); --報錯
SQL> commit;
Commit complete
SQL> select * fromt_number;
??? ID????ID1
------ -------
?10001?10.003
?10001?10.003
?
在Oracle中NUMBER的定義:
1、只有一個參數時,如NUMBER(24)。表示所定義的數字最大可設置24位整數。
2、有兩個參數時,如NUMBER(38,3)。表示所定義的數字最大是38位長,其中包含3位小數。就是說這個類型最大可設置35位整數和3位小數。
3、小數位超出長度會進行四舍五入,整數位超出長度報錯。
轉載于:https://blog.51cto.com/90sirdb/1940538