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

2024-05-03

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

<i>ORA-01438: value larger than specified precision allows for this column</i>

完整响应如下所示:

<?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>

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


您尝试存储的数字对于该字段来说太大了。查看规模和精度。两者之间的区别在于可以存储的小数点前面的位数。

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

低端的任何内容都会被截断(默默地)

select cast (5.33333333 as number(3,2)) from dual;
CAST(5.33333333ASNUMBER(3,2))
-----------------------------
                         5.33
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

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

随机推荐