totn Oracle Error Messages

Oracle / PLSQL: ORA-00924 Error Message

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

Description

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

  • ORA-00924: missing BY keyword

Cause

You tried to execute a GROUP BY, ORDER BY, CONNECT BY, or GRANT (with IDENTIFIED) statement and missed the BY keyword.

Resolution

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

Option #1

Try adding the missing BY keyword and re-execute the statement.

For example, if you tried to execute the following:

SELECT department, SUM(sales) AS "Total sales"
FROM order_details
GROUP department;

You would receive the following error message:

Oracle PLSQL

You could correct this error with the following statement:

SELECT department, SUM(sales) AS "Total sales"
FROM order_details
GROUP BY department;