I have three basic queries that are related to each other and I need a single result set to return.
Simplified:
Query1 (possible return not a show stopper return null):
SELECT * FROM monkey WHERE monkey.ENDDATE IS NULL AND monkey.TEMPLATEID = 1
Query2 (possible return not a show stopper return null):
SELECT * FROM banana WHERE banana.ENDDATE IS NULL AND banana.TEMPLATEID = 1
Query3 (must return something):
SELECT * FROM tree WHERE tree.TEMPLATEID = 1
Query 1 and 2 may or may not return a value (come back null).
The third one will need to return a result (or not) IF the third query returns something I and query 1 or 2 fail I still want to return something.
I can’t do an outer join with 2 queries, because oracle won’t let me the error said… a.b (+) = b.b and a.c(+) = c.c is not allowed instead turn b+c into a view.
I think I understand the logical reason, never-the-less I need to return query 3 and maybe query 1, 2 or 1 and 2 along with 3 as a single result set.
I hope this makes sense.
You seem to be hitting ORA-01417. Using made up tables and data as you haven’t provided any, or the join conditions, I can get the same effect by trying to outer join
monkeyto bothtreeandbanana– in a completely contrived way, of course:if you use the ‘new’ (since 9i, I think) ANSI join syntax, rather the Oracle-specific
(+)notation, you can do more:See the documentation for some of the restrictions on
(+); Oracle recommend using the ANSI version, though they seem to use their own most of the time in examples in the documentation.