关闭

[置顶] oracle使用一个表的数据更新另一张表

标签: oracleinsert
6282人阅读 评论(0) 收藏 举报

--查询库位表中没有的库位
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;

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:1110102次
    • 积分:12389
    • 等级:
    • 排名:第1187名
    • 原创:299篇
    • 转载:84篇
    • 译文:1篇
    • 评论:57条
    文章分类
    最新评论