Coding⏱️ 3 min read📅 2026-06-03

How to Fix: Update statement with inner join on Oracle

Oracle UPDATE statement with inner join error fix.

Quick Answer: Use parentheses to group the JOIN and SET clauses, and ensure correct table aliasing.

The error ORA-00933: SQL command not properly ended occurs when Oracle Database is unable to parse the SQL statement due to an unexpected character or syntax issue. This error affects all users who run the query on Oracle, causing them to be unable to update data in table1.

This error can be frustrating because it does not provide clear information about the cause of the problem. However, by following these steps, you should be able to identify and fix the issue, allowing you to continue using your query.

🔍 Why This Happens

  • The first main reason why this error happens is that the INNER JOIN clause in the UPDATE statement is causing Oracle to parse the SQL statement incorrectly. This is because Oracle does not support using the INNER JOIN clause with an UPDATE statement.
  • Another possible cause of this error is that there is a syntax issue with the SET clause, such as missing or mismatched parentheses.

🚀 How to Resolve This Issue

Rewrite the query to use a subquery instead of an inner join

  1. Step 1: Replace the INNER JOIN clause with a subquery using the IN operator: UPDATE table1 SET value = (SELECT code FROM table2 WHERE DESC = value AND UPDATETYPE = 'blah')
  2. Step 2: Verify that the subquery is correctly selecting the desired data and update values.
  3. Step 3: Test the updated query to ensure it produces the expected results.

Modify the query to use a different join type or syntax

  1. Step 1: Replace the INNER JOIN clause with a LEFT JOIN or RIGHT JOIN: UPDATE table1 SET value = LCODE FROM (SELECT LCODE, DESC FROM table2 WHERE UPDATETYPE = 'blah' AND DESC = value) AS subquery ON table1.value = subquery.DESC
  2. Step 2: Verify that the modified query is correctly selecting the desired data and update values.
  3. Step 3: Test the updated query to ensure it produces the expected results.

✨ Wrapping Up

By following these steps, you should be able to identify and fix the issue causing ORA-00933: SQL command not properly ended in Oracle. Remember to always test your queries thoroughly after making changes to ensure they produce the desired results.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions