Categories: Oracle Errors

ORA-00933: SQL command not properly ended | ORA-00933 Resolution

ORA-00933 : SQL command not properly ended :

In my previous articles, I have given the proper idea of different oracle errors, which are frequently come. In this article, I will try to explain the most common error, which has been shared, on google 10 k times per month. ORA-00933 is straightforward error might come because of inappropriate use of any SQL clause.

Error Cause and Resolution :

ORA-00933 error is very common error, which will come because of using the SQL clause in inappropriate syntax. There is no another root cause of this error. User might check the clause at appropriate place to resolve this issue. I will explain different scenarios of this error

  1. Use of Order by / Group by Clause in Insert Statement :

This error will come because of the improper use of ‘Order by’ clause in insert statement. Kindly try to implement following scenario :

CREATE TABLE Test_Error

(Roll_no NUMBER(10),NAME VARCHAR2(30));

 

INSERT INTO Test_Error

values(1,’Amit’) order by roll_no;

 

 

Resolution of error :

Kindly remove the order by clause from select statement.

 

INSERT INTO Test_Error

VALUES(1,’Amit’);

commit;

 

User needs to check the error the syntax of inappropriate clauses in SQL.The clauses might be either ‘Order by’ or ‘Group by’.So the root cause of this error is placing of clause at inappropriate place.

  1. Use of Order by / Group by Clause in delete Statement :

In above example I have given example of order by clause. In this example I will try to produce this error with group by clause. User can not be used the group by clause with delete statement. This is most common syntax error.

delete from Test_Error group by Roll_no;

 

Error report:

SQL Error: ORA-00933: SQL command not properly ended

  1. 00000 – “SQL command not properly ended”

*Cause:

*Action:

 

Solution of the error :

Remove group by Roll_no clause. The statement will be:

Delete from Test_Error;

 

3.Improper use of joins in update statement :

The improper use of join in update statement one of the main cause of this error.

Example :

UPDATE S_SRV_REQ set SR_NUM =’1000’

FROM S_SRV_REQ_XM SRVX

JOIN S_SRV_REQ sr ON SRVX.ROW_ID = sr.PAR_ROW_ID;

 

In above example user is trying to update the SR_NUM but  user is using the join condition between two tables. So user needs to change the query as below :

UPDATE S_SRV_REQ SR

SET SR_NUM =’1000’

WHERE SR.ROW_ID IN (SELECT SRVX.PAR_ROW_ID FROM S_SRV_REQ_XM SRVX);

 

 

 

Amit S

Oracle Consultant with vast experience in Oracle BI and PL/SQL Development. Amiet is the admin head of this website who contributes by preparing tutorials and articles related to database technologies. He is responsible to manage the content and front-end of the website.

Share
Published by
Amit S

Recent Posts

The Essential Guide to Cryptocurrency Exchange Platform Development for Beginners and Beyond

Introduction Cryptocurrencies took the world by storm, setting up a new financial system and breaking…

5 months ago

Top 20 System Administrator Interview Questions and answers

In my previous article I have given Top 20 technical support interview questions with its…

8 months ago

Desktop Support Scenario Based Interview Questions

In my previous articles I have given 15 most asked desktop support interview questions with…

8 months ago

How Do Business Analysts Use SQL for Their Needs?

A business analyst is someone who is versed in processes of data analysis used for…

8 months ago

Top 15 Control-M Interview Questions with Answers

In my previous article I have already given top questions and answers for Desktop support…

8 months ago

Top 20 SQL Interview Questions for Production Support

In my previous article I have given unix production support interview questions and answers. In…

8 months ago