dbTalk Databases Forums  

full outer join on 8i

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss full outer join on 8i in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default full outer join on 8i - 07-19-2006 , 07:04 AM






On 8i, I have some rows that are not returning in a select query. The
sql is much bigger then this, but the basic problem is....

select *
from
tableA a,
tableB b,
tableC c
where a.someID = b.id(+)
and a.someID = c.id(+)
and a.ref like '%4E%'

Now keep in mind that (in this rare case) a.someID is null where a.ref
like '%4E%'
This is a sort of "triple check" finance report to ensure certain
project budget values have not been missed.

To get the row to return in 8i, I was hoping to apply what I read
here...
http://www.oreillynet.com/pub/a/netw.../fulljoin.html

Note that the "(+)" is moved to the other side in the second select
below...
---------------------------------------
select *
from
tableA a,
tableB b,
tableC c
where a.someID = b.id(+)
and a.someID = c.id(+)
and a.ref like '%4E%'
UNION ALL
select *
from
tableA a,
tableB b,
tableC c
where a.someID(+) = b.id
and a.someID(+) = c.id
and a.ref like '%4E%'
-----------------------------------------
The error I get is ORA-01417
A table may be outer joined to at most one other table

Be nice ; )


Reply With Quote
  #2  
Old   
Brian Peasland
 
Posts: n/a

Default Re: full outer join on 8i - 07-19-2006 , 08:15 AM






Full outer joins were not implemented until Oracle 9i (a good reason to
upgrade that database?). Since you are using pre-9i, you will have to
rewrite the query to use a UNION of two OUTER JOINs, similar to the
following:

SELECT a.col1,a.col2,b.colA,b.colB
FROM tableA a, tableB b
WHERE a.someID = b.id (+)
AND a.ref LIKE '%4E%'
UNION
SELECT a.col1,a.col2,c.colA,c.colB
FROM tableA a, tableC c
WHERE a.someID = c.id (+)
AND a.ref LIKE '%4E%';

It looks like your UNION query is not written correctly.

HTH,
Brian


--
================================================== =================

Brian Peasland
dba (AT) nospam (DOT) peasland.net
http://www.peasland.net

Remove the "nospam." from the email address to email me.


"I can give it to you cheap, quick, and good.
Now pick two out of the three" - Unknown

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.