Hi,
I am trying to update by left joining the tables as below. when the data matches update the tbl2 value to tbl1, else update the value in tbl1 to 0. Can you let me know how to achieve this in Oracle 12g.
create table tbl1 (id int,sku int);
create table tbl2 (id int,sku int);
insert into tbl1 values(1,5);
insert into tbl1 values(2,10);
insert into tbl1 values(3,15);
insert into tbl1 values(4,20);
insert into tbl2 values(1,55);
insert into tbl2 values(3,11);
update tbl1 left join tbl2 on tbl1.id=tbl2.id set tbl1.sku = coalesce(tbl2.sku,0);