如何考虑 Oracle NUMBER(23,20) 中的数据类型

how to Consider Datatype in Oracle NUMBER(23,20)

创建table foo ( dd杯数(23,20) );

插入记录时

插入 foo 值 (-3260.78510542844)

我遇到了错误 ORA-01438: 值大于此列允许的指定精度

如何 oracle 考虑数字 (23,20) 的数据

如果您的列是 NUMBER(23,20) 意味着该列将接受最多 23 位数字的任何值,并且该数字的精度最多为 20 位数字。

但是你需要意识到,如果你已经有最多20位小数的精度,因为那是你定义的精度,你的整数只能取3。

SQL> create table t ( c1 number(23,20) ) ;

Table created.

SQL> insert into t values ( 202039.20202020 ) ;
insert into t values ( 202039.20202020 )
                       *
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column


SQL> insert into t values ( 202.20202020 ) ;

1 row created.

SQL> insert into t values ( 2021010101 );
insert into t values ( 2021010101 )
                       *
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column


SQL> insert into t values ( 4000 ) ;
insert into t values ( 4000 )
                       *
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column


SQL>  insert into t values ( 202.20202020330992223 ) ;

1 row created.

SQL>