Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ORA-00918: column ambiguously defined: how to find the column

I'm getting the classic error:

ORA-00918: column ambiguously defined

Usually, I know how to solve it but my problem now is that I'm working with a 700 row query.

Is there a way to identify the column?

like image 884
Daniele Avatar asked Sep 17 '12 14:09

Daniele


1 Answers

Have you tried to do a binary search?

e.g.

If your original query looks like

Select  col1 
       ,col2
       ,col3
       ,col4
from MyTable
  1. you can start with commenting the 2nd half
Select  col1
       ,col2
       /*,col3
       ,col4 */
from MyTable
  1. If you still get the error, run the query again commenting some column from the other half:
Select col1
       /*,col2 */
      ,col3
      ,col4
from MyTable

If you still get an error then your problem is with col1, otherwise you need to change col2.

like image 145
Ricardo Arnold Avatar answered Jan 04 '23 15:01

Ricardo Arnold