| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.misc -> Outer joins on constants (or variables)
Hello,
I have an interesting question regarding outer joins -
Is it true that outer joins don't work on constants or variables?
I am running Oracle 7.1.6.2 and have the following query:
1 select j1.qaz,a,b,c
2 from j1,j2,j3
3 where j1.qaz = 3
4 and j2.qaz(+) = 3
5 and j3.qaz(+) = 3
Where the constant 3 is replaced by a bind variable. Since 3 does not exist in all three tables, I get "no rows selected", instead of null in the table that does not contain 3.
Here is my data:
J1 -
QAZ A
---------- ----------
1 1
2 1
3 1
4 1
J2 -
QAZ B
---------- ----------
3 2
4 2
J3 -
QAZ C
---------- ----------
2 3
4 3
If I change lines 4,5 to read ...(+) = j1.qaz then it works as expected.
Another side note: As long as any column is outer joined, other columns can be compared to nulls - ex: add j3.c(+) = 3 to the where clause.
Any thoughts?
John Higley
Tektronix, Inc.
john.m.higley_at_tek.com
Received on Wed Mar 05 1997 - 00:00:00 CST
![]() |
![]() |