有没有一种自动方法可以将Oracle的联接语法(+)转换为标准联接语法?

时间:2019-09-10 18:18:55

标签: oracle postgresql database-migration outer-join ansi-sql

从Oracle转换为PostgreSQL,有很多SQL可以从Oracle的联接语法“(+)”转换为标准联接语法。有自动的方法-工具-来做到这一点吗?除此以外,进行此类转换时是否有经验法则?

例如,将其转换为

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

对此

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

1 个答案:

答案 0 :(得分:1)

这是一种算法:

  • 如果x.a = y.b(+)子句中有WHERE,请转动

    FROM x, y
    

    FROM x LEFT JOIN y ON x.a = y.b
    
  • 类似于左侧的(+)RIGHT JOIN