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: ORA-00918 expected but ...

Re: ORA-00918 expected but ...

From: DA Morgan <damorgan_at_psoug.org>
Date: Wed, 11 Apr 2007 08:18:01 -0700
Message-ID: <1176304675.98711@bubbleator.drizzle.com>


Torsten Edler wrote:
> I have a small example (which i have stripped down from a real world
> problem) which puzzles me. It consists of an outer join of three
> tables where i would expect to get an ORA-00918 "column ambiguously
> defined" but Oracle 10.2.0.3.0 on Windows accepts it perfectly well.
>
> create table t1 (x number, y1 number);
> create table t2 (x number, y2 number);
> create table t3 (x number, y2 number);
>
> insert into t1 values (1,1);
> insert into t1 values (2,2);
> insert into t3 values (2,2);
>
> select distinct t1.x, y1, x, t2.x, a.x
> from t1
> left outer join t2 on t1.x=t2.x
> left outer join t3 a on t1.x=a.x
> ;
>
> the db chooses x automatically to mean t2.x instead of complaining
> about ambiguity

There is no ambiguity. You aliased t3 to be "a" and you joined t1.x to a.x (which is t3.x).

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace x with u to respond)
Puget Sound Oracle Users Group
www.psoug.org
Received on Wed Apr 11 2007 - 10:18:01 CDT

Original text of this message

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