I am trying to wrap my head around the old oracle Left Join syntax. It\'s fine with two tables:
FROM A, B
WHERE
A.Col = B.Col (+)
(Lets cal
(+) style outer joins are inferior in terms of functionality compared to standard ANSI OUTER JOINS (as well as readability IMHO), which Oracle supported since 9i.
What you want is effectively
FROM C
LEFT JOIN A ON C.C = A.C
LEFT JOIN B ON A.C = B.C
Does it make sense now? To be honest, I don't quite understand your questions because how the above syntax works is really obvious to me...
You can see it in a cascading way. However, the key is to look for those tables which are left and right joined within the same query. In this case, the order is different: the condition where the table is right joined is applied first. I hope the following diagram will shed some light on this:
You can also check the order of these joins by looking at the execution plan of the query:
For Q1:
select a.c a, b.c b, c.c c from a, b, c where a.c = b.c (+) and
c.c = a.c (+)
------------------------------------------------------------------------
| Id | Operation | Name | E-Rows | OMem | 1Mem | Used-Mem |
------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | | |
|* 1 | HASH JOIN OUTER | | 4 | 2168K| 2168K| 805K (0)|
|* 2 | HASH JOIN OUTER | | 4 | 2616K| 2616K| 981K (0)|
| 3 | TABLE ACCESS FULL| C | 4 | | | |
| 4 | TABLE ACCESS FULL| A | 4 | | | |
| 5 | TABLE ACCESS FULL | B | 4 | | | |
------------------------------------------------------------------------
For Q2:
select a.c a, b.c b, c.c c from a, b, c where c.c = a.c (+) and
a.c = b.c (+)
------------------------------------------------------------------------
| Id | Operation | Name | E-Rows | OMem | 1Mem | Used-Mem |
------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | | | |
|* 1 | HASH JOIN OUTER | | 4 | 2168K| 2168K| 801K (0)|
|* 2 | HASH JOIN OUTER | | 4 | 2616K| 2616K| 983K (0)|
| 3 | TABLE ACCESS FULL| C | 4 | | | |
| 4 | TABLE ACCESS FULL| A | 4 | | | |
| 5 | TABLE ACCESS FULL | B | 4 | | | |
------------------------------------------------------------------------