表名 临时表名 正式表名
表1 tb1_temp tb1
表2 tb2_temp tb2
表3 tb3_temp tb3
表4 tb4_temp tb4
临时表和正式表结构字段等完全相同
这里通过接口把数据存入到了临时表中,现在需要把临时表中所有的数据插入到正式表中,我想写个存储过程执行以后四个表一起更新插入,没思路,希望大家能给点建议和思路,本人菜鸟希望能详细点,存过不是很熟悉。
oracle?存储过程?数据结构
------解决方案--------------------
如果不需要考虑数据是否存在,直接插入不就好了吗?如果需要,加上where ..not exists 做下判断
create or replace procedure pro_ins as
begin
insert into tb1 select * from tb1_temp;
insert into tb2 select * from tb2_temp;
insert into tb3 select * from tb3_temp;
insert into tb4 select * from tb4_temp;
end;
楼主主要纠结的是哪个环节呢?
------解决方案--------------------
merge into 存在就更新,不存在就插入
------解决方案--------------------