SQL Returning Wrong Results and Not Reporting ORA-918 When Using ANSI Join (Doc ID 453033.1)

Last updated on DECEMBER 06, 2016

Applies to:

Oracle Database - Enterprise Edition - Version 10.2.0.1 to 10.2.0.3 [Release 10.2]
Oracle Database - Enterprise Edition - Version 9.2.0.1 to 9.2.0.8 [Release 9.2]
Information in this document applies to any platform.
***Checked for relevance on 10-May-2016***


Symptoms

While running ANSI Join query on three tables, Sql Statement run's fine in version 9.2.0.1 - 9.2.0.6 and 10.2.0.1 to 10.2.0.3. But in case of 9.2.0.7 and 9.2.0.8 ORA-918 is logged.



create table TEST_A
( A NUMBER,
  B NUMBER,
  C NUMBER
);

create table TEST_B
( D NUMBER,
  E NUMBER);
 
create table TEST_C
( G NUMBER,
  H NUMBER,
  A NUMBER);

Insert some dummy records

SQL> SELECT a, b, c FROM test_a a left join test_b b on (b.d = a.c) left join 
test_c c on c.a = a.a;


         A          B          C
---------- ---------- ----------
         1          1          1
         2          2          2
         3          3          3
                    4          4

On changing query to have only two tables, we get ORA-918

SQL> select a,c from test_a a,test_c c where c.a = a.a
  2  ;
select a,c from test_a a,test_c c where c.a = a.a
       *
ERROR at line 1:
ORA-00918: column ambiguously defined





.

Changes

 

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms