ORA-00918: column ambiguously defined
OracleWhat does it mean?
A column with the same name exists in more than one table in the query, and because it is used without a table/alias prefix, Oracle cannot determine which table it belongs to.
Why does it happen?
Both joined tables have a column with the same name (e.g. ID in both); the column is used unqualified (without a prefix) in SELECT, WHERE or ORDER BY.
How to fix it
Qualify every ambiguous column with the table name or alias: SELECT a.id, b.id FROM tableA a JOIN tableB b ON a.id = b.a_id; Give tables short aliases and prefix all columns to improve readability and clarity.
More from this engine
- ORA-02291integrity constraint violated - parent key not found
- ORA-02292integrity constraint violated - child record found
- ORA-00979not a GROUP BY expression
- ORA-06550line/column PLS-... PL/SQL compilation error
- ORA-04068existing state of packages has been discarded
- ORA-01427single-row subquery returns more than one row
- ORA-12899value too large for column