隨筆-7  評論-24  文章-102  trackbacks-0


          Oracle 10g 數(shù)據(jù)類型
          SQL Server 2005 的數(shù)據(jù)類型


          附錄:
          1、關(guān)于 NUMBER(p,s) ,能表示的有效值為 1.0 x 10-130 to (but not including) 1.0 x 10126
              p:精度值,指有效位數(shù),從左邊第一個不為0的數(shù)算起,小數(shù)點和負(fù)號不計入有效位數(shù)。取值范圍為 0 ~ 38 。
              s:標(biāo)度值,小數(shù)點右邊最小有效數(shù)字位數(shù)。取值范圍為 -84 ~ 127 。
                ● s>0:精確到小數(shù)點右邊 s 位,并四舍五入。
                ● s<0:精確到小數(shù)點左邊 s 位,并四舍五入。
          例如:
              NUMBER(5,3)可以存儲的數(shù)字形式為: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.
              當(dāng) s > p 時,例如 NUMBER(4,5) ,必須數(shù)值為 0.0xxxx 的數(shù)字(小數(shù)點后 s-p 位加0)。

          示例:
           定義格式  輸入數(shù)值  存儲狀態(tài)
           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 黃小二 閱讀(1173) 評論(0)  編輯  收藏 所屬分類: [DB].Oracle[DB].SQL Server
          主站蜘蛛池模板: 新竹市| 宾阳县| 乌鲁木齐市| 家居| 涞水县| 仲巴县| 廉江市| 左云县| 化州市| 于田县| 乌恰县| 汕尾市| 伽师县| 金阳县| 南川市| 五指山市| 宁波市| 商丘市| 九寨沟县| 双城市| 抚松县| 牙克石市| 广饶县| 宝山区| 金华市| 隆尧县| 牟定县| 德安县| 凉山| 靖远县| 福海县| 县级市| 尚志市| 高台县| 泗洪县| 茂名市| 察雅县| 湘乡市| 潼南县| 沙田区| 南开区|