ORA-00936: missing expression | How to resolve ORA-00936 error?

ORA-00936: missing expression :

In my previous article, I have explained about the most common errors in Oracle. In This article, I will try to explain another most common error, which has been searched approximately 15000 times in a month by DBAs and developers. When you forget the actual syntax of the oracle select statement then the ORA-00936 missing expression error will come. While working with databases I have frequently faced ORA-00936: missing expression and struggled to solve and debug this issue. This kind of error will occur when user miss the syntax of SQL expression.

ORA-00936: missing expression is very common oracle error occurred due to the syntax of oracle statement.

Why ORA-00936 error will come?

Some Oracle mistakes are not nearly as intimidating to resolve, as the error message would seem to indicate. The ORA-00936 is the perfect example of such a case. This error provides an excellent case where thinking too hard about the answer will cost you far more time and effort than needed.

Reason for this error:

The ORA-00936 message is a missing expression error in Oracle. That entire ‘missing expression’ means is that when attempting to operate a query, a particular part of the clause necessary for it to function was omitted in the text. Stated simply, you left out an important chunk of what you were trying to run. This is most common error occurred during the syntax of SQL statement. If user failed to write or omit something in SQL query then ‘Missing Expression’ error will come.

Missing Information in Select Statement:

  If user forgets to write the columns in the select statement then missing expression error will come.

Example:

Select * from Employee;

Select from Employee;   —Error of missing expression will come.

From Clause is Omitted:

If user forgets to write the ‘from clause’ in select statement then missing expression error will come.

 ORA-00936

NO TIME TO READ CLICK HERE TO GET THIS ARTICLE

 Example:

Select * from Employee;

Select * Employee;   —Missing Expression error will come

 Resolution of the error:

As I have explained that missing expression error will come due to the bad syntax of ‘Select statement’ user needs to check the select statement is properly written or not. While working with huge queries then it is not easy for the user to find out where the actual error is. So finding out where the error is coming is important.

Resolution 1:

User needs to check the missing information from select statement. Most of the time the column names are missing in select statement.User needs to check that all columns are there in select statement.User needs to check the columns using desc command and make changes in the select statement.

Example :

Select from Employee;

It will fire that error so user needs to check the columns in Employee table using following statement:

Desc Employee;

Select Employee_Name,Employee_Number from Employee;

Resolution 2 :

Add from Clause in select statement

User needs to add ‘From’ clause at proper place in select statement.

Select * Employee;

Resolution Query :

Select * from Employee;

So these kind of errors are very easy to solve just user needs to concentrate on syntax of select statement.