Informix SQL 错误 - 为什么此 UPDATE 语句不起作用?

发布于 2024-12-22 01:20:31 字数 784 浏览 3 评论 0原文

使用 IBM Informix Dynamic Server 版本 10.00.FC9

我收到的错误是:

1226:小数或货币值超出最大精度。

通常,这是完全合理的,我可以通过 修复精度CAST,但我尝试的所有操作仍然产生相同的错误。

我最初将三列设置为常量 0.00。经过一些陈述后,我已将其中两列更新为正小数,保持相同的精度。

当我尝试将这两列相乘以更新第三列时,出现上述错误。

我的更新语句是:UPDATE table SET col_3 = col_1*col_2;


I've tried several things, but have had no luck in avoiding that error.

我尝试将 col_3 中的常量设置为 0.000000

我还尝试在乘法的两侧和最终值上使用 CAST 进行更新:

UPDATE table SET col_3 = CAST((col_1) AS DECIMAL(6,2))*CAST( (col_2) AS DECIMAL(6,2));

更新表 SET col_3 = CAST((col_1*col_2) AS DECIMAL(6,2));

这些尝试的任何组合总是会导致相同的错误。

有谁知道我在这里缺少什么或做错了什么?

Using IBM Informix Dynamic Server Version 10.00.FC9

The error I'm getting is:

1226: Decimal or money value exceeds maximum precision.

Normally, this makes perfect sense and I can fix the precision via CAST, but everything I try is still producing the same error.

I have three columns that I initially set to a constant of 0.00. After a few statements, I have updated two of these columns to positive decimals keeping the same precision.

When I try to multiply these two columns together to update the third column, I get the error above.

My update statement is: UPDATE table SET col_3 = col_1*col_2;


I've tried several things, but have had no luck in avoiding that error.

I tried setting the constant in col_3 to 0.000000.

I also tried updating using CAST on both the two sides of the multiplication and the final value:

UPDATE table SET col_3 = CAST((col_1) AS DECIMAL(6,2))*CAST((col_2) AS DECIMAL(6,2));

UPDATE table SET col_3 = CAST((col_1*col_2) AS DECIMAL(6,2));

Any combination of these attempts always results in the same error.

Does anyone know what I'm missing here or doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

策马西风 2024-12-29 01:20:31

我需要将常量设置为 12.00

我缺少小数点前的两位

I needed to set the constant to 12.00

I was missing the two places before the decimal

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文