Home Privacy Policy Feedback Link to us Site Map

Oracle/PLSQL: ORA-00937 Error


Error:

ORA-00937: not a single-group group function

Cause:

You tried to execute a SELECT statement that included a GROUP BY function (ie: MIN, MAX, SUM, COUNT), but was missing the GROUP BY clause.

Action:

The options to resolve this Oracle error are:
  1. Rewrite the SELECT statement so that the column or expression listed in the SELECT list is also found in the GROUP BY clause.
  2. Remove the GROUP BY function (ie: MIN, MAX, SUM, COUNT) from the SELECT statement.
  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, MIN(salary) as "Lowest salary"
FROM employees;


You would receive the following error message:


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

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