Oracle / PLSQL: ORA-00979 Error Message

Learn the cause and how to resolve the ORA-00979 error message in Oracle.

When you encounter an ORA-00979 error, the following error message will appear:

Mục Lục

Resolution

The option(s) to resolve this Oracle error are:

Option #1

Rewrite the SELECT statement so that the column or expression listed in the SELECT list is also found in the GROUP BY clause.

Option #2

Remove the GROUP BY function (ie: MIN Function, MAX Function, SUM Function, COUNT Function) from the SELECT statement.

Option #3

Remove the expression from the SELECT list that was not in the GROUP BY clause.

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

SELECT department, company, MIN(salary) AS "Lowest salary"
FROM employees
GROUP BY department;

You would receive the following error message:

Oracle PLSQL

You could correct this by including company in the GROUP BY clause as follows:

SELECT department, company, MIN(salary) AS "Lowest salary"
FROM employees
GROUP BY department, company;

Alternate Text Gọi ngay