ORA-00907: missing right parenthesis
Oracle hit something it didn't expect inside parentheses. Often the parentheses are balanced and the real problem is a syntax error inside them.
- Error code
ORA-00907- Category
- Syntax and SQL statements
What it means
ORA-00907 means that while parsing a parenthesized part, such as a column list, a function call or a subquery, Oracle met a token where it expected ). The name is misleading: the real cause is often invalid syntax inside the parentheses, which makes Oracle think the group should have ended.
Common causes
- A genuinely missing
). ORDER BYinside a subquery used in anINlist or as a scalar subquery.- A datatype without its length, or with options from another database, inside
CREATE TABLE: for exampleVARCHAR2without a size, orAUTO_INCREMENT. - A missing comma between column definitions or constraints.
How to fix it
-
Check the contents of the parentheses near the reported position, not just the count.
-
Remove
ORDER BYfrom subqueries where it isn't allowed.SELECT * FROM hr.employees WHERE department_id IN (SELECT department_id FROM hr.departments WHERE location_id = 1700);
-
Use Oracle syntax in table definitions, for example an identity column instead of
AUTO_INCREMENT.CREATE TABLE notes ( id NUMBER GENERATED ALWAYS AS IDENTITY PRIMARY KEY, body VARCHAR2(4000) );
Related errors
More syntax and sql statements errors
ORA-00911invalid characterORA-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 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.