ORA-00933: SQL command not properly ended
Oracle finished parsing a valid statement and found more text after it: a stray clause, a trailing semicolon passed through a driver, or syntax from another database.
- Error code
ORA-00933- Category
- Syntax and SQL statements
What it means
ORA-00933 means the statement was complete up to a point and what followed didn't fit. It often comes from syntax that works in other databases but not in Oracle, or from a semicolon sent to the database through JDBC, ODBC or EXECUTE IMMEDIATE, where Oracle doesn't accept it.
Newer releases give the position: unexpected keyword at or near keyword_value.
Common causes
- A trailing
;in SQL sent through a driver or dynamic SQL. - Using
ASbefore a table alias (FROM employees AS e); Oracle allowsASonly for column aliases. LIMITorTOP(Oracle usesFETCH FIRST n ROWS ONLYfrom 12c).- An
ORDER BYinside anINSERT ... SELECTsubquery or a misplaced clause. UPDATE ... FROMorDELETE ... JOINsyntax from SQL Server or MySQL.
How to fix it
-
Drop the semicolon when sending a single SQL statement through a driver or
EXECUTE IMMEDIATE. -
Write table aliases without
AS.SELECT e.last_name FROM hr.employees e;
-
Use Oracle's row-limiting clause.
SELECT * FROM hr.employees ORDER BY salary DESC FETCH FIRST 10 ROWS ONLY;
-
Rewrite joined updates with
MERGEor a correlated subquery.MERGE INTO orders o USING customers c ON (c.id = o.customer_id) WHEN MATCHED THEN UPDATE SET o.region = c.region;
Related errors
ORA-00936missing expressionORA-00907missing right parenthesisORA-00923FROM keyword not found where expected102SQL Server: Incorrect syntax near42601PostgreSQL: syntax error at or near1064MySQL: You have an error in your SQL syntax
More syntax and sql statements errors
ORA-00911invalid characterORA-00917missing commaORA-00918column ambiguously definedORA-00937not a single-group group functionORA-00979not a GROUP BY expressionORA-01427single-row subquery returns more than one rowORA-01008not all variables boundORA-01747invalid user.table.column specification
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.