Oracle (+) outer join and constant values

后端 未结 4 1967
感情败类
感情败类 2021-02-09 13:13

I\'m running into an issue with which I can\'t figure out how to correctly configure a join. I\'m using reporting software that utilizes the (+) indicators in the WHERE clause f

4条回答
  •  一整个雨季
    2021-02-09 14:02

    Join option 1 will consider only those rows where CHK.CURRENT = 'Y'. Therefore, if the transaction has no check, CHK.CURRENT will be NULL and the row will not be in the result set.

    Join option 2 will consider those rows where CHK.CURRENT, if there was a check, is 'Y'. If the transaction has no check, this test will not be applied and the row will be in the result set.

    You can see the difference with this comparison:

    Select *
    FROM TXN,CHK
    WHERE
    TXN.CHK_ID = CHK.CHK_ID(+)
    and TXN.CURRENT = 'Y'
    and CHK.CURRENT(+) = 'Y'
    MINUS
    Select *
    FROM TXN,CHK
    WHERE
    TXN.CHK_ID = CHK.CHK_ID(+)
    and TXN.CURRENT = 'Y'
    and CHK.CURRENT = 'Y'
    

提交回复
热议问题