jane Doe jane Doe - 1 month ago 6
SQL Question

SQL command not properly ended : Update SET FROM JOIN

When I try to execute the script below on sql developer I've got this exception :



  1. 00000 - "SQL command not properly ended"




UPDATE T1 SET T1.IDC= T2.IDC
FROM T1
JOIN T2 ON (T1.IDC=T2.IDO);


I don't get what's wrong with my script.
Can Anyone help please?

Answer

In Oracle you do not have the JOIN clause in the UPDATE statement. You can use the following: UPDATE T1 SET T1.IDC = (SELECT T2.IDC from T2 WHERE T2.IDO = T1.IDC) Add the WHERE clause if you do not want to update the entire table.

Comments