17,086
社区成员
发帖
与我相关
我的任务
分享
for rec in (select s.pnt_id
from table_1 s
and rownum<=1000
where s.flag = 0
order by s.pnt_id ) loop
update table_2 h
set h.sync_flag = 1,
h.status = 1
where h.hpt_id = rec.pnt_id;
end loop;
是这样吗
for rec in (select s.pnt_id
from table_1 s
where s.flag = 0) loop
update table_2 h
set h.sync_flag = 1,
h.status = 1
where h.hpt_id = rec.pnt_id;
end loop;
一次1000条怎么写
-- 大概这个样子;
begin
loop
update t2 set col1 = 1 , col2 = 2
where exists(select* from t1 where t1.id =t2.id)
and rownum< =1000;
commit ;
exit when row%count <= 0 ;
end loop ;
end ;
/