Oracle 10g 數據類型
SQL Server 2005 的數據類型
附錄:
1、關于 NUMBER(p,s)
,能表示的有效值為 1.0 x 10
-130 to (but not including) 1.0 x 10
126。
p:精度值,指有效位數,從左邊第一個不為0的數算起,小數點和負號不計入有效位數。取值范圍為 0 ~ 38 。
s:標度值,小數點右邊最小有效數字位數。取值范圍為 -84 ~ 127 。
● s>0:精確到小數點右邊 s 位,并四舍五入。
● s<0:精確到小數點左邊 s 位,并四舍五入。
例如:
NUMBER(5,3)可以存儲的數字形式為:pp.sss。
ps.
Scale can be greater than precision, most commonly when e notation is used. When scale is greater than precision, the precision specifies the maximum number of significant digits to the right of the decimal point. For example, a column defined as NUMBER(4,5) requires a zero for the first digit after the decimal point and rounds all values past the fifth digit after the decimal point.
當 s > p 時,例如 NUMBER(4,5) ,必須數值為 0.0xxxx 的數字(小數點后 s-p 位加0)。
示例:
定義格式 |
輸入數值 |
存儲狀態 |
NUMBER |
123.89 |
123.89 |
NUMBER(5) |
123.89 |
124 |
NUMBER(5,0) |
123456 |
ORA-01438: 值大于為此列指定的允許精度 |
|
|
|
NUMBER(6,2) |
123.89 |
123.89 |
|
123.8951 |
123.9 |
|
|
|
NUMBER(2,5) |
0.000811 |
0.00081 |
|
123.89 |
ORA-01438: 值大于為此列指定的允許精度 |
|
1.2e-4 |
0.00012 |
posted on 2008-10-13 00:29
黃小二 閱讀(1172)
評論(0) 編輯 收藏 所屬分類:
[DB].Oracle 、
[DB].SQL Server