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: HELP! Oracle Won't Let Me Outer Join...

Re: HELP! Oracle Won't Let Me Outer Join...

From: Daniel Morgan <damorgan_at_exesolutions.com>
Date: Mon, 08 Apr 2002 16:15:15 GMT
Message-ID: <3CB1C20C.503CBF4B@exesolutions.com>


You can usually solve this problem with an in-line view.

Perform the first outer-join within the SELECT statement that makes up the FROM clause. Then perform an outer join to that. For example:

SELECT field1, field3
FROM (
   SELECT field1
   FROM tab1, tab2
   WHERE tab1.field1 = tab2.field1 (+) ) inline,    tab3
WHERE inline.field1 =tab3.field3(+);

I have used "inline" to alias the in-line view.

Daniel Morgan

contrapositive wrote:

> Hi. I have a query that looks something like this...
>
> SELECT ...
> FROM
> ORDER_HEADERS h,
> ORDER_DETAILS d,
> ...,
> INVOICES i
> WHERE ...
> AND
> decode(sign(d.TOTAL_PRICE), -1, 'C', 'D') --'C'redit/'D'ebit
> ||
> h.ORDER_NUMBER
> = i.INVOICE_NUMBER(+)
>
> So I need to outer join on INVOICES, but I get the "table may be outer
> joined to only one other table" error. I didn't realize this error
> also applies to concatenation.
>
> This is a legacy database, so I can't manipulate the table definitions
> or anything. Is there some creative way to work through this?
>
> Thanks in advance...
>
> -jk
Received on Mon Apr 08 2002 - 11:15:15 CDT

Original text of this message

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