Home Privacy Policy Feedback Link to us Site Map

Oracle/PLSQL: ORA-00960 Error


Error:

ORA-00960: ambiguous column naming in select list

Cause:

You tried to execute a SELECT statement where a column with the same name is listed in the SELECT list and then ambiguously defined within the ORDER BY clause.

Action:

The options to resolve this Oracle error are:
  1. Try prefixing the column that is ambiguously defined in the ORDER BY clause with the table name.

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

SELECT supplier.supplier_id, orders.supplier_id
FROM supplier, orders
WHERE supplier.supplier_id = orders.supplier_id
ORDER BY supplier_id;


You would receive the following error message:


You could correct this error by prefixing the supplier_id column in the ORDER BY clause with either supplier or orders.

For example:

SELECT supplier.supplier_id, orders.supplier_id
FROM supplier, orders
WHERE supplier.supplier_id = orders.supplier_id
ORDER BY supplier.supplier_id;

OR

SELECT supplier.supplier_id, orders.supplier_id
FROM supplier, orders
WHERE supplier.supplier_id = orders.supplier_id
ORDER BY orders.supplier_id;