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 -> Re: Cartesian outer join with plus-sign syntax

Re: Cartesian outer join with plus-sign syntax

From: Steve Howard <stevedhoward_at_gmail.com>
Date: Tue, 18 Dec 2007 09:33:58 -0800 (PST)
Message-ID: <3eea7bb1-a694-43e8-aec0-85023a4c8b9a@v4g2000hsf.googlegroups.com>


On Dec 18, 12:14 pm, j.w.vandijk.removet..._at_hetnet.nl (Jaap W. van Dijk) wrote:

> What I meant was: I want to perform a cartesian join of two tables A
> and B (no join conditions between columns of the two tables).
>
> But: if table B is empty I still want to see all the records of table
> A, with the columns of table B in the select-list filled with null.
>
> The latter may not be a outer join in the strict sense, I don't know,
> but it looks a lot like it, so I called the combination cartesian
> outer join.
>
> A regular cartesian join yields no records if one of the tables is
> empty, so I did some thinking and fiddling and found a solution that
> yields what I want, but I wondered if there are other solutions,
> because the problem seems so simple and my solution so cumbersome.
>
> The version in which I tried tried this is 9.2.0.5.
>
> Regards, Jaap.

Hi Jaap,

It looks like a full outer join (available in 9.2.0.5, IIRC) should work?

SQL> create table a(c number);

Table created.

SQL> create table b(c number);

Table created.

SQL> insert into a select rownum from dba_objects where rownum < 10;

9 rows created.

SQL> commit;

Commit complete.

SQL> select a.c,b.c from a full outer join b on b.c=a.c   2 /

         C C
---------- ----------

         5
         8
         3
         1
         2
         6
         7
         4
         9

9 rows selected.

SQL> Regards,

Steve Received on Tue Dec 18 2007 - 11:33:58 CST

Original text of this message

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