Toad World® Forums

Update Query with INNER JOIN

Hi Everyone,

Having read another post regarding Update with inner join, I tried to use the same syntax. However I get the following error:

ORA-00933: SQL command not properly ended

The website I used to develop the code is as follows:

http://www.toadworld.com/platforms/sql-server/b/weblog/archive/2013/06/18/sql-server-update-table-with-inner-join.aspx

My code is as follows:


Update table1

Set table1.occupationcode = table2.occupationcode

From table1

INNER JOIN table2

on reformat_diincdataraw.treatynumber = table2.treatynumber

and table1.polno = table2.polno

and table1.dateofbirth = table2.dateofbirth

and table1.namefamily = table2.namefamily

and table1.dateofextract = table2.dateofextract


Can you please advise where I might be going wrong?

The version of TOAD I am using is 10.6.1.3

Thank You

do you get the same error when you run in pure oracle sqlplus with same user?

update table1
set table1.occupationcode = (select table2.occupationcode
where table1 INNER JOIN table2
on reformat_diincdataraw.treatynumber = table2.treatynumber
and table1.polno = table2.polno
and table1.dateofbirth = table2.dateofbirth
and table1.namefamily = table2.namefamily
and table1.dateofextract = table2.dateofextract
)

why do you use join “reformat_diincdataraw.treatynumber = table2.treatynumber” and no column from “reformat_diincdataraw” table? This table is sufficient?