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


          Oracle 10g 數據類型
          SQL Server 2005 的數據類型


          附錄:
          1、關于 NUMBER(p,s) ,能表示的有效值為 1.0 x 10-130 to (but not including) 1.0 x 10126
              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 黃小二 閱讀(1173) 評論(0)  編輯  收藏 所屬分類: [DB].Oracle[DB].SQL Server
          主站蜘蛛池模板: 博野县| 富源县| 平原县| 金坛市| 九龙坡区| 江华| 新沂市| 汽车| 胶州市| 晋宁县| 广安市| 图木舒克市| 合肥市| 蕲春县| 浦县| 岑巩县| 海淀区| 曲阳县| 琼中| 灌云县| 湾仔区| 承德市| 新营市| 台中市| 儋州市| 宜城市| 泗洪县| 东明县| 班戈县| 合水县| 义马市| 漾濞| 雅江县| 达拉特旗| 石棉县| 建水县| 泉州市| 花垣县| 泸水县| 江孜县| 鹿泉市|