Oracle (+) outer join and constant values

后端 未结 4 2361
情书的邮戳
情书的邮戳 2021-02-09 13:08

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:01

    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'
    

提交回复
热议问题