Oracle 查询中出现 NVL 错误
更新oracle后,下面的查询开始返回奇怪的结果,它应该返回包含一些值的列,但返回null
,在对查询进行一些调整后,发现如果我更改t.event_id = d .event_id
和 t.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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
从 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.