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 to [Release 10.2]
Oracle Database - Enterprise Edition - Version to [Release 9.2]
Information in this document applies to any platform.
***Checked for relevance on 10-May-2016***


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

create table TEST_A

create table TEST_B
create table TEST_C

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





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