从 ANSI 到 Oracle 连接语法的转换

发布于 2024-10-19 10:27:12 字数 816 浏览 3 评论 0原文

我想将以下查询:转换

SELECT
    request.requestId
FROM
    request
    LEFT OUTER JOIN incident ON incident.requestId = request.requestId
    LEFT OUTER JOIN changeRequest ON changeRequest.requestId = request.requestId

为等效的 Oracle join 语法。我的第一次尝试:

SELECT
    request.requestId
FROM
    request,
    incident,
    changeRequest
WHERE
    incident.requestId = request.requestId(+)
    AND changeRequest.requestId = request.requestId(+)

由于“ORA-01417:一个表最多可以外部连接到另一个表”错误而不起作用。

我意识到 Oracle 建议使用 ANSI 方法,但是我“遭受”以下 Oracle bug 的困扰:

http://awads.net/wp/2007/06/14/when-ansi-sql-join-syntax-does-not- work-in-oracle/

预先感谢, 本

I would like to convert the following query:

SELECT
    request.requestId
FROM
    request
    LEFT OUTER JOIN incident ON incident.requestId = request.requestId
    LEFT OUTER JOIN changeRequest ON changeRequest.requestId = request.requestId

into it's Oracle join syntax equivalent. My first attempt:

SELECT
    request.requestId
FROM
    request,
    incident,
    changeRequest
WHERE
    incident.requestId = request.requestId(+)
    AND changeRequest.requestId = request.requestId(+)

does not work because of the "ORA-01417: a table may be outer joined to at most one other table" error.

I realise that Oracle recommend using the ANSI approach, however I am "suffering" from the following Oracle bug:

http://awads.net/wp/2007/06/14/when-ansi-sql-join-syntax-does-not-work-in-oracle/

Thanks in advance,
Ben

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

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

发布评论

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

评论(2

黯然#的苍凉 2024-10-26 10:27:12

你的 (+) 写错了,应该是:

SELECT
    request.requestId
FROM
    request,
    incident,
    changeRequest
WHERE
    incident.requestId (+)= request.requestId
    AND changeRequest.requestId (+)= request.requestId

顺便说一句,我假设你意识到这是旧的 Oracle 语法? Oracle 长期以来一直支持 ANSI 连接。

You have the (+) on the wrong side, it should be:

SELECT
    request.requestId
FROM
    request,
    incident,
    changeRequest
WHERE
    incident.requestId (+)= request.requestId
    AND changeRequest.requestId (+)= request.requestId

BTW I assume you realse this is the old Oracle syntax? Oracle has supported ANSI joins for a long time now.

感情洁癖 2024-10-26 10:27:12

仅供参考,根据我们的痛苦经验,Oracle(版本 10,11 和 12)中复杂的 ANSI 内部联接有时会导致 ORA-00600 错误(核心转储)。我们被迫将许多 ANSI 连接回溯到 Oracle 连接以避免这种情况。

FYI, in our painful experience, complex ANSI inner joins in Oracle (versions 10,11, and 12) occasionally cause ORA-00600 errors (core dumps). We have been forced to backtrack many of our ANSI joins back to Oracle joins to avoid this.

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