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
.The (+)
operator tells Oracle that a predicate is part of an outer join rather than a filter predicate that can be applied after the join. Using the SQL 99 outer join syntax, the first query is equivalent to
SELECT *
FROM txn
left outer join chk
on( txn.chk_id = chk.chk_id )
WHERE txn.current = 'Y'
AND chk.current = 'Y'
while the second is equivalent to
SELECT *
FROM txn
left outer join chk
on( txn.chk_id = chk.chk_id AND
chk.current = 'Y')
WHERE txn.current = 'Y'
Logically, in the first case, you do the outer join but then all the rows where chk.current
was NULL
get filtered out. In the second case, the chk.current = 'Y'
condition doesn't filter out any rows, it just controls whether a matching row is found in chk
or whether a left outer join is performed.