Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Outer Join to Multiple Tables

Outer Join to Multiple Tables

From: Alvin Sylvain <alvin_at_c-square.no.junk>
Date: 1997/01/07
Message-ID: <32D2C64C.4272@c-square.no.junk>#1/1

I'm converting an application from Sybase to Oracle, and I've run into a number of quandries.

In this case, Sybase allowed us to perform an outer join to several tables besides the "main" one, and Oracle apparently will only do this for one.

Eg: Say you have a personnel table, with a join to a company table, but the person might not be employed, and a join to a school table, but the person might not be in school, etc.

   select p.name, c.name, s.name
   from personnel p, company c, school s    where 1=1

     and p.companyname (+) = c.name
     and p.schoolname  (+) = p.name

We could do this in Sybase. If the person was both unemployed and not in school, you'd simply get his name and two nulls. If he was in school, you'd get his name, a null, and the school's name. Etc.

Oracle complains very explicitly that you can only perform an outer join if the table is outer joined to exactly one other table. This sucks.

I suppose I could add an "empty" row with the value "'NULL'" for the key, set all the linking columns to "'NULL'", and remove the outer join: but that seems to me as being an awful lot of trouble, and doesn't at all match the intent of the query.

Or am I making some wrong assumptions?

Any suggestions would be massively appreciated.

Thanks in advance!

-- 
+-------------------------+------------------------------------------+

| Alvin Sylvain | If government is the answer, it's time |
| alvin_at_c-square.com | to re-evaluate the question. |
| PLEASE! NO JUNK E-MAIL! | NO E-MAIL SOLICITATIONS!! NO SPAM!! |
+-------------------------+------------------------------------------+
Received on Tue Jan 07 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US