oracle 表数据更新另一个表,oracle使用一个表的数据更新另一张表
--查询库位表中没有的库位
select * from L_IMPORTDATA_TEMP where location_code not in (select t.location_code from l_location t) ;
--第一步:插入库位表中没有的刻录
--insert into l_location select * from L_IMPORTDATA_TEMP where location_code not in (select t.location_code from l_location t) ;
--commit;
--第二步:更新记录数据
--没用select * from l_location l where l.location_code in (select location_code from L_IMPORTDATA_TEMP);
--闪回Insert Into L_LOCATION (Select * From L_LOCATION As Of Timestamp to_Timestamp('2012-3-24 13:24:30','yyyy-mm-dd hh24:mi:ss') )
savepoint derek;
UPDATE l_location L
SET ( materialscode,capacity,inventory,shelfnum,orders,status,fathercode,isvirtualreal)=
(SELECT materialscode,capacity,inventory,shelfnum,orders,status,fathercode,isvirtualreal FROM L_IMPORTDATA_TEMP T WHERE l.location_code = t.location_code and l.storagecode=209)
where location_code in (select location_code from L_IMPORTDATA_TEMP) and l.storagecode=209;
commit;
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)