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

What is Root Cause Analysis (RCA) With real examples

In my previous article I have given details about application support engineer day to day…

2 weeks ago

Application Support Engineer Day to day responsibilities

In my previous articles I have given the roles and responsibilities of L1,L2 and L3…

2 weeks ago

What is mean by SLA ( Service Level Agreement) with Examples?

In my previous articles i have given the hierarchy of production support in real company…

2 weeks ago

What is Production support Hierarchy in organization?

In this article i would like to provide information about production support organization structure or…

2 weeks ago

What are roles and responsibilities for L3 Support Engineer?

In my previous article I have given roles for L1 and L2 support engineer with…

2 weeks ago

What are roles and responsibilities of L2 Engineer?

I have started this new series of how to become application support engineer. This article…

2 weeks ago