你是想把store的storecode都插到download 还是download里面存在的storecode就不用插了,对于后者你可以直接sql语句insert into download
select storecode, sysdate, 'normal', 'sysdba'
from store b
where not exists
(select 1 from download a where b.storecode = a.storecode)
当然你也可以用function,可以使用游标循环
select storecode, sysdate, 'normal', 'sysdba'
from store b
where not exists
(select 1 from download a where b.storecode = a.storecode)
当然你也可以用function,可以使用游标循环
for rec in (select * from store) loop
insert into download values (rec.storecode,sysdate,'normal','sysdba');
end loop;
commit;