200高分求解决方案(解决后再加送100)
发布网友
发布时间:2022-12-27 09:53
我来回答
共3个回答
热心网友
时间:2023-10-19 16:15
老是出现ORA-01438: value larger than specified precision allows for this column.意思是插入的值对于表中某列来讲太大.该错误提到了precision(精度),所以可以判断该错误是一个有关数字列的问题.经过查看表结构发现, 有几个NUMBER列都全部定义为number(8)或number(8,2)的形式.
NUMBER列的最大精度为38位,如果按number定义,也就是说后面不用定义精度和小数点,就不会出现这个问题,除非是一个很大的浮点数.看oracle的说明:
The NUMBER datatype stores fixed and floating-point numbers. Numbers of virtually
any magnitude can be stored and are guaranteed portable among different systems
operating Oracle, up to 38 digits of precision.
The following numbers can be stored in a NUMBER column:
■ Positive numbers in the range 1 x 10-130 to 9.99...9 x 10125 with up to 38 significant digits
■ Negative numbers from -1 x 10-130 to 9.99...99 x 10125 with up to 38 significant digits
■ Zero
■ Positive and negative infinity (generated only by importing from an Oracle Version 5 database)
For numeric columns, you can specify the column as:
column_name NUMBER
Optionally, you can also specify a precision (total number of digits) and scale (number of digits to the right of the decimal point):
column_name NUMBER (precision, scale)
..............................
看了开发人员的存储过程发现有好几个有关计算结果都超出了8位精度,能不出错吗?如果要用NUMBER列,程序设计者必须对计算结果有所了解.要不然就不要定义精度.
看看下面的例子:
Input Data Specified As Stored As
7,456,123.89 NUMBER 7456123.89
7,456,123.89 NUMBER(*,1) 7456123.9
7,456,123.89 NUMBER(9) 7456124
7,456,123.89 NUMBER(9,2) 7456123.89
7,456,123.89 NUMBER(9,1) 7456123.9
7,456,123.89 NUMBER(6) (not accepted, exceeds precision)这种定义就会导致ORA-01438错误
7,456,123.89 NUMBER(7,-2) 7456100
热心网友
时间:2023-10-19 16:15
等答案
热心网友
时间:2023-10-19 16:16
重新安装