ORACLE 中NUMBER类型默认的精度

NUMBER往往没有指定P,S的值,那么默认情况下,NUMBER的P、S的值分别是多少呢?

武断的判断“如果不指定p和s,NUMBER类型,它的默认精度值为38, 默认的scale值为0”

 

 

 

创建表
create table test(id number, id1 number(38,4));

插入数据 insert into test
select 12, 12 from dual union all select 12.123456789, 12.123456789 from dual;
查看数据
select
* from test; ID ID1
-------------------------------------------------- -------------------------------------------------- 12.000000000000000000000000000000000000 12.0000000000000000000000000000000000000 12.123456789000000000000000000000000000 12.1235000000000000000000000000000000000

最大精度多少个小数

insert into test
select 12.123456789123456789123456789123456789123,
12.123456789123456789123456789123456789123
from dual;

 

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.

 

p是精度,有效十进制数的总位数。最大的有效数字是最左边的非零数字,而最小有效位是最右边的数字。 Oracle保证数字的可移植性

精度高达20 base-100 digits,相当于39位或40位十进制数字,取决于小数点的位置(小数点前偶数是40位,小数点奇数位39位)。

posted @ 2022-09-21 16:12  葫芦杯  阅读(642)  评论(0编辑  收藏  举报