ORA-00921: unexpected end of SQL command
The statement stops before it is complete, for example a WHERE with no condition or SQL text cut off when it was built or copied.
- Error code
ORA-00921- Category
- Syntax and SQL statements
What it means
ORA-00921 means Oracle reached the end of the statement while it still expected more, such as a condition after WHERE or a value after =.
Common causes
- Dynamic SQL that ends with
WHEREorANDbecause the last condition was empty. - A statement truncated by a client, a variable size limit or a copy and paste.
How to fix it
-
Print the final SQL text and complete the clause that is cut off.
-
When building conditions in code, add
ANDonly between existing conditions, or start withWHERE 1 = 1.
Related errors
More syntax and sql statements errors
ORA-00907missing right parenthesisORA-00911invalid characterORA-00917missing commaORA-00918column ambiguously definedORA-00923FROM keyword not found where expectedORA-00937not a single-group group functionORA-00979not a GROUP BY expressionORA-01427single-row subquery returns more than one row
The code and message text are from the Oracle Database Error Help. Browse the full Oracle error list or search every database error.
Work on Oracle in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for Oracle and the other databases you use.