How to Fix ORA-00936: Missing Expression in Oracle

Find where Oracle expected a value or column in ORA-00936: trailing commas, empty lists, and comparisons with no right side.

ORA-00936 means Oracle reached a place in a statement where a value, column, or other expression must come, and found none. A select list with nothing in it, a comma with nothing after it, a comparison with no right side, or an empty IN list all raise it. The column number in the error points to where the expression is missing.

Reproduce the Error

Example:

select from dual;
select 1, from dual;
select 1 from dual where 1 = ;
select 1 from dual where 1 in ();

Output:

Error starting at line : 1
In command -
select from dual
Error at Command Line : 1 Column : 8
Error report -
SQL Error: ORA-00936: missing expression

Error starting at line : 2
In command -
select 1, from dual
Error at Command Line : 2 Column : 11
Error report -
SQL Error: ORA-00936: missing expression

Error starting at line : 3
In command -
select 1 from dual where 1 =
Error at Command Line : 3 Column : 29
Error report -
SQL Error: ORA-00936: missing expression

Error starting at line : 4
In command -
select 1 from dual where 1 in ()
Error at Command Line : 4 Column : 32
Error report -
SQL Error: ORA-00936: missing expression
  • SELECT FROM has no column at all.
  • The comma after 1 announces another column that never comes.
  • The comparison 1 = has no right side.
  • An IN list must contain at least one value.

How to Fix It

  • Go to the reported column and add the missing expression, or remove the operator or comma before it.
  • In generated SQL, check for empty variables: a statement built as 'where id = ' || v_id with v_id NULL ends in =, and an IN list built from an empty collection ends in ().
  • Prefer bind variables to building values into SQL text; a missing bind raises a clearer error.

Things to Know

  • A trailing comma before FROM, a common slip when removing the last column, raises ORA-00936.
  • Characters Oracle cannot read as an expression, such as @, can produce ORA-00936 too.

Related Guides

Conclusion

ORA-00936 marks a place where Oracle needed an expression and found none. Use the column number to find the empty spot: a dangling comma or operator, an empty select list, or an empty IN list, often caused by a variable that was empty when SQL was generated.

Vinish Kapoor
Vinish Kapoor

An Oracle ACE, author of four books on Oracle APEX, SQL and PL/SQL, and Oracle Forms, and a software developer building Oracle database applications since 2001.

guest

0 Comments
Oldest
Newest Most Voted