精度和小数位数在Oracle NUMBER数据类型中意味着什么 [英] What does precision and scale means in the Oracle NUMBER data type

查看:142
本文介绍了精度和小数位数在Oracle NUMBER数据类型中意味着什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读oracle DB入门指南.精度和小数位数的定义非常混乱. 书说:

I have been reading Beginners guide for oracle DB. The definition for precision and scale are quite confusing. Book says:

number(6,3) 

Oracle allows for 2 not 6 significant digitalis.

我的问题是6表示精度.这表示有效位数.因此它应该接受6位有效数字.这本书为什么说是2位有效数字

my problem is, 6 means precision. which means number of significant digits. so it should accept 6 significant digits. why does the book says it is 2 significant digits

我要指的书是 Oracle数据库11g McGraw Hill Professional的《初学者指南》,2008年12月18日,第12页,

The book i am referring to is Oracle Database 11g A Beginner's Guide by McGraw Hill Professional, Dec 18, 2008, page number 12

推荐答案

查看在线Oracle

Check out the online Oracle doc:

p是精度或有效小数位数的最大值 数字,其中最高有效数字是最左边的非零 数字,最低有效数字是最右边的已知数字. Oracle保证数字的可移植性,精度最高可达 20个以100为基数的数字,相当于39或40个十进制数字 取决于小数点的位置.

p is the precision, or the maximum 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是小数位数,或从小数点到位数的位数. 最低有效数字.范围从-84到127.

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.

正数位是指右边数字的有效位数 小数点到并包括最低有效数字.

Positive scale is the number of significant digits to the right of the decimal point to and including the least significant digit.

负数比例是指数字左侧的有效位数. 小数点,到但不包括最低有效数字.为了 负标度,最低有效数字在左侧 小数点,因为实际数据四舍五入到指定的 小数点左边的位数.例如,一个 规格(10,-2)表示四舍五入.

Negative scale is the number of significant digits to the left of the decimal point, to but not including the least significant digit. For negative scale the least significant digit is on the left side of the decimal point, because the actual data is rounded to the specified number of places to the left of the decimal point. For example, a specification of (10,-2) means to round to hundreds.

这篇关于精度和小数位数在Oracle NUMBER数据类型中意味着什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆