简体   繁体   English

从ANSI转换为Oracle Join语法

[英]Conversion from ANSI to Oracle Join Syntax

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. 它与Oracle连接语法等效。 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. 由于出现“ ORA-01417:一个表最多可以外部连接到另一个表”错误而无法使用。

I realise that Oracle recommend using the ANSI approach, however I am "suffering" from the following Oracle bug: 我意识到Oracle建议使用ANSI方法,但是我受到以下Oracle错误的“折磨”:

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

Thanks in advance, Ben 预先感谢,本

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语法吗? Oracle has supported ANSI joins for a long time now. Oracle长期以来一直支持ANSI连接。

FYI, in our painful experience, complex ANSI inner joins in Oracle (versions 10,11, and 12) occasionally cause ORA-00600 errors (core dumps). 仅供参考,根据我们的痛苦经历,Oracle中复杂的ANSI内部联接(版本10、11和12)有时会导致ORA-00600错误(核心转储)。 We have been forced to backtrack many of our ANSI joins back to Oracle joins to avoid this. 为了避免这种情况,我们不得不将许多ANSI联接回溯到Oracle联接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM