--sql写法:
update bcd_samplingrecord_detail
set Invalid=t.cin,hasfilter=t.ch
from (select recordid cid,Invalid cin,hasfilter ch from bcd_samplingrecord) t
where recordid=t.cid

--Oracle写法:卡死人
update bcd_samplingrecord_detail t1
set (t1.Invalid,t1.hasfilter)=(select Invalid,hasfilter from bcd_samplingrecord t2 where t2.recordid=t1.recordid) 


--直接游标
begin
  for c in (select * from bcd_samplingrecord)
    loop
      update bcd_samplingrecord_detail 
      set Invalid=c.invalid,hasfilter=c.hasfilter
      where recordid=c.recordid;
    end loop;
end;

 

posted on 2022-01-18 19:06  vinsonLu  阅读(2022)  评论(0编辑  收藏  举报