Database Error Messages

Release
toggle
  • 23ai
Updated
Jun 24, 2024

ORA-03162

expression: must appear in the GROUP BY clause or be used in an aggregate function as 'group_by_position_enabled' is FALSE
  • expression: The expression that is missing from the GROUP BY clause.

Cause

The specified expression is not part of either the GROUP BY clause, an aggregate function, or a constant but appears in a part of the query that is processed after the GROUP BY clause, such as the SELECT clause, the ORDER BY clause, or the HAVING clause. Because group by position is disabled by default, the integer number in the GROUP BY clause is not treated as the position of an expression in the SELECT list.


Action

Either add the expression to the GROUP BY clause or enable group by position and add the position of the expression in the GROUP BY clause. Ensure that any columns in the SELECT list that are not part of an aggregate function are present in the GROUP BY clause. Ensure parameter 'group_by_position_enabled' is set to TRUE if the integer number in the GROUP BY clause is intended as the position of an expression in the SELECT list.