日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

【NUMBER】有关Oracle NUMBER类型定义中precision和scale的测试和总结

發(fā)布時間:2024/4/17 编程问答 25 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【NUMBER】有关Oracle NUMBER类型定义中precision和scale的测试和总结 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

?http://space.itpub.net/519536/viewspace-557312

?

【NUMBER】有關(guān)Oracle NUMBER類型定義中precision和scale的測試和總結(jié)

上一篇 / 下一篇 ?2010-09-11 22:47:28 / 個人分類:SQL

查看( 245 ) / 評論( 0 ) / 評分( 0 / 0 ) NUMBER數(shù)據(jù)類型的定義格式是:NUMBER(p,s)。本文對定義中的p(precision)和s(scale)做一個解釋和總結(jié)。

1.官方文檔中有關(guān)NUMBER數(shù)據(jù)類型的描述
p is the precision, or the total number of significant decimal digits, where the most significant digit is the left-most nonzero digit, and the least significant digit is the right-most known digit. Oracle guarantees the portability of numbers with precision of up to 20 base-100 digits, which is equivalent to 39 or 40 decimal digits depending on the position of the decimal point.

s is the scale, or the number of digits from the decimal point to the least significant digit. The scale can range from -84 to 127.

2.關(guān)于NUMBER數(shù)據(jù)類型的測試
create table test ( a number(1,3));

insert into test values(0.12);
??????????????????????? *
第 1 行出現(xiàn)錯誤:
ORA-01438: 值大于此列指定的允許精度


insert into test values(0.012);

已創(chuàng)建 1 行。

insert into test values(0.0125);

已創(chuàng)建 1 行。

select * from test;

???????? A
----------
????? .012
????? .013

3.小結(jié)
1)整數(shù)部分長度>p-s時,報錯;
2)小數(shù)部分長度>s時,舍入;
3)s為負數(shù)時,對小數(shù)點左邊的s數(shù)字進行舍入;
4)當(dāng)s>p時,p表示小數(shù)后第s位向左最多可以有多少位數(shù)字,如果大于p則報錯,小數(shù)點后s位向右的數(shù)字被舍入.

Good luck.

secooler
10.09.11

-- The End --

總結(jié)

以上是生活随笔為你收集整理的【NUMBER】有关Oracle NUMBER类型定义中precision和scale的测试和总结的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。