Oracle 查询中出现 NVL 错误

发布于 2024-12-20 06:32:15 字数 652 浏览 5 评论 0原文

更新oracle后,下面的查询开始返回奇怪的结果,它应该返回包含一些值的列,但返回null,在对查询进行一些调整后,发现如果我更改t.event_id = d .event_idt.event_id = 125162 查询开始像以前一样工作。有什么建议吗?

SELECT LEAST (
          MAX (
             d.event_step
             - (CASE WHEN d.status IN (51, 52, 53) THEN 0 ELSE 2 END)),
          3)
          AS nextStep
  FROM x_events_step d
 WHERE d.event_id = 125162 AND d.state = 1
       AND d.event_step_id >
              NVL ( (SELECT MAX (t.event_step_id)
                       FROM x_events_step t
                      WHERE t.event_id = d.event_id AND t.state = 2),
                   0);

After updating the oracle the query below starts returning strange results, it should returns column with some values but returns null, after some twiching with the query, found that if I change t.event_id = d.event_id with t.event_id = 125162 query start working like before. Any advice?

SELECT LEAST (
          MAX (
             d.event_step
             - (CASE WHEN d.status IN (51, 52, 53) THEN 0 ELSE 2 END)),
          3)
          AS nextStep
  FROM x_events_step d
 WHERE d.event_id = 125162 AND d.state = 1
       AND d.event_step_id >
              NVL ( (SELECT MAX (t.event_step_id)
                       FROM x_events_step t
                      WHERE t.event_id = d.event_id AND t.state = 2),
                   0);

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

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

发布评论

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

评论(1

旧情勿念 2024-12-27 06:32:15

从 Oracle 11.2.0.2 升级到 11.2.0.3 后问题得到解决。

After upgrade from Oracle 11.2.0.2 to 11.2.0.3 the problem was resolved.

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