Home Privacy Policy Feedback Link to us Site Map

Oracle/PLSQL: ORA-00918 Error


Error:

ORA-00918: column ambiguously defined

Cause:

You tried to execute an SQL statement that joined two or more tables, where a column with the same name exists in both tables.

Action:

The options to resolve this Oracle error are:
  1. Prefix the column with the table name and then re-execute the statement.

For example, if you tried to execute the following SQL statement:

SELECT supplier_id, quantity
FROM suppliers, orders
WHERE suppliers.supplier_id = orders.supplier_id;


You would receive the following error message:


Since the supplier_id column exists in both the suppliers and orders table, you need to prefix the column with the table name as follows:

SELECT suppliers.supplier_id, quantity
FROM suppliers, orders
WHERE suppliers.supplier_id = orders.supplier_id;