An incorrect clause at the end of a SQL command causes the ORA-00933 error message to appear. Oracle SQL statements have standard clauses that can be used together. The ORA-00933 error notice appears when a clause is introduced that does not normally fall under the command of a SQL query.
When attempting to execute an INSERT statement containing an ORDER BY clause, an ORA-00933 error is frequently encountered. ORDER BY clauses in statements to insert items in a specific order or with Construct VIEW to create an ordered view are not supported in Oracle.
In practice, this implies you started with an INSERT statement and ended on the last line with an incorrect clause, such as ORDER BY, resulting in the error notice. Simply remove the ORDER BY clause from the end of the phrase to fix the problem. Make careful to re-insert the statement-ending semi-colon on the line before the ORDER BY clause.
Why ORA-00933: SQL command not properly ended occurs?
The SQL statement finishes with a clause that isn’t suitable. An ORDER BY clause, for example, may have been added in a CREATE VIEW or INSERT statement. ORDER BY can’t be used to make an ordered view or insert items in a specific order.
What action should perform to remove ORA-00933 error?
Remove the clauses that aren’t needed from the syntax. Another SQL statement might be able to duplicate the removed clause. To organize the rows of a view, for example, do so while querying the view rather than when creating it. If a continuation line is indented, this issue can also occur with SQL*Forms applications. Look for any indented lines and eliminate them.
SET EMP.DEPTO = DEPT.DEPTNO
INNER JOIN DEPARTMENT ON DEPT DEPT.DEPTNO = EMP.DEPT_NO;
ORA-00933: SQL command not properly ended
SET EMP.DEPT_NO = (select dept_no from dept where dept_no = emp.dept_no);