0

The query is as follows

select tbl1.x, tbl2.y
  from
tbl1, tbl2
  where tbl1.some_column (+) = tbl2.some_column
  AND tbl1.some_column2 (+) = 'Y'

What confuses me is this part

 AND tbl1.some_column2 (+) = 'Y'

What does it mean?? If I remove the (+) the query returns completely different number of rows. I do understand the application of (+) when there are columns names on the both sides of the =, but what does (+) do when there is a string on the one side of the = ?

Denys
  • 4,287
  • 8
  • 50
  • 80

1 Answers1

7

It's legacy syntax that Oracle had before they had LEFT OUTER JOIN (or, in this case, probably RIGHT OUTER JOIN).

No need to use it anymore in modern Oracle (at least from 9i, maybe even 8i).

Now you can use the standard SQL join syntax:

SELECT tbl1.x, tbl2.y
FROM tbl1 RIGHT OUTER JOIN tbl2 
ON ( tbl1.some_column = tbl2.some_column AND tbl1.some_column2 = 'Y')
Thilo
  • 257,207
  • 101
  • 511
  • 656
  • Is there a way to implement this condition without explicitly naming the join i.e. listing tables using coma and using the where clause afterward? – Denys Oct 04 '13 at 12:41
  • 1
    @Dennis - Yes, and that is exactly what the query in **your post** does. – PM 77-1 Oct 04 '13 at 13:12