Reputation: 51
UPDATE TABLE1 SET COL1 = 'UPDATED'
INNER JOIN TABLE2 ON TABLE1.ID = TABLE2.ID
WHERE COL2 = '1' AND COL3 IN('A','B') AND COL4 = 'NEW'
The above command throwing 'SQL command not properly ended', may I know why is it happening? NOTE: COL2 , COL2 resides in TABLE1 while COL4 In TABLE2, if that is helpful.
Upvotes: 0
Views: 972
Reputation: 1269953
Oracle doesn't support explicit join's in its update
syntax (it does support joins when using subqueries under certain conditions). A query like this should work:
update TABLE1
set COL1 = 'UPDATED'
where col2 = '1' and col3 in ('A', 'B') and col4 = 'NEW' and
exists (select 1
from TABLE2
where TABLE1.ID = TABLE2.ID
);
The conditions in the where
may need to go in the subquery, if they refer to TABLE2
.
Upvotes: 1