create table tq84_src (
id number(7 ) primary key,
val number(5,2)
);
create table tq84_dst (
id number(7 ) primary key,
val number(5,2)
);
The following statement throws ORA-38101: Invalid column in the INSERT VALUES Clause: "DST"."ID":
merge into tq84_dst dst
using (
select
id,
val
from
tq84_src src
) src
on (
src.id = dst.id
)
when matched then
update set dst.val = src.val
when not matched then
insert (id, val)
values (id, val) -- <<< correct here to "values(src.id, src.val)"
;
The corrected statement is
merge into tq84_dst dst
using (
select
id,
val
from
tq84_src src
) src
on (
src.id = dst.id
)
when matched then
update set dst.val = src.val
when not matched then
insert ( id, val)
values (src.id, src.val)
;