3,491
社区成员
发帖
与我相关
我的任务
分享
--emp_rowid(5亿) 存放emp表需要更新ROWID、序号
--emp(15亿)
declare
v_rowid dbms_sql.Urowid_Table;
cursor cur is
select t.row_id from emp_rowid t where a.rno <= 10000000;
begin
open cur;
loop
exit when cur%notfound;
fetch cur bulk collect
into v_rowid limit 1000;
forall i in 1 .. v_rowid.count
update emp set flag = 2 where rowid = v_rowid(i);
commit;
end loop;
commit;
close cur;
end;
update /*+ paralle(t,64)*/ emp t
set t.flag = 2
where exists (select 1
from emp_rowid a
where a.row_id = t.rowid
and a.rno <= 10000000)
这两种写法有毛病没有,还有更优的吗?求大神指导问题。