ORA-01438:大于指定精度的值允许此列

use*_*104 13 sql database oracle plsql ora-01438

我们的合作伙伴数据库有时会收到以下错误:

<i>ORA-01438: value larger than specified precision allows for this column</i>
Run Code Online (Sandbox Code Playgroud)

完整响应如下所示:

<?xml version="1.0" encoding="windows-1251"?>
<response>
  <status_code></status_code>
  <error_text>ORA-01438: value larger than specified precision allows for this column ORA-06512: at &quot;UMAIN.PAY_NET_V1_PKG&quot;, line 176 ORA-06512: at line 1</error_text>
  <pay_id>5592988</pay_id>
  <time_stamp></time_stamp>
</response>
Run Code Online (Sandbox Code Playgroud)

导致此错误的原因是什么?

Gar*_*ers 11

您要存储的数字对于该字段来说太大了.看看SCALE和PRECISION.两者之间的差异是您可以存储的小数位前面的位数.

select cast (10 as number(1,2)) from dual
             *
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column

select cast (15.33 as number(3,2)) from dual
             *
ERROR at line 1:
ORA-01438: value larger than specified precision allowed for this column
Run Code Online (Sandbox Code Playgroud)

低端的任何东西都被截断(默默地)

select cast (5.33333333 as number(3,2)) from dual;
CAST(5.33333333ASNUMBER(3,2))
-----------------------------
                         5.33
Run Code Online (Sandbox Code Playgroud)

  • 实际上,下端不是截断的,而是在Oracle中舍入:从双精度中选择强制转换(5.66666666为数字(3,2)); - >返回5.67 (2认同)

Tho*_*ten 7

该错误似乎不是字符字段之一,而是更多数字字段.(如果它是像WW提到的字符串问题,你会得到'值太大'或类似的东西.)可能你使用的数字超过了允许的数字,例如1,000000001在一个定义为数字的列中(10,2) ).

查看WW提到的源代码,找出可能导致问题的列.然后检查那里正在使用的数据.


WW.*_*WW. 3

这表明您正在尝试将太大的内容放入列中。例如,您有一个 VARCHAR2(10) 列,并且要输入 11 个字符。数字也是如此。

这发生在 UMAIN 包的第 176 行。你需要去看看它,看看它是做什么的。希望您可以在源代码管理中(或从 user_source )查找它。Oracle 的更高版本更好地报告此错误,告诉您哪个列和什么值。