I am trying to merge two tables in oracle and the query i am using is
merge into sales_history sh
using sales s
on (s.prod=sh.prod and s.month=sh.month)
when matched
update set sh.amount = s.amount
when not matched
insert (sh.prod,sh.month,sh.amount)
values (s.prod,s.month,s.amount);
Whenever I execute this query i get the following error:
ORA-00905 missing keyword.
Can anyone help me with this.
when matched THEN update .... when not matched THEN ...
– a_horse_with_no_name