日期:2014-05-16  浏览次数:20637 次

Oracle 大批量、海量数据更新

?

?方法1:
declare?
TYPE?seqnoType?IS?TABLE?OF?err_usage_gprs.sequence_no%TYPE;
seqnos?seqnoType;
?????
BEGIN
???SELECT?sequence_no?BULK?COLLECT?INTO?seqnos?FROM?err_usage_gprs?WHERE?sequence_no?<=?1000;
?
???FORALL?i?in?seqnos.FIRST?..seqnos.LAST
??????update?err_usage_gprs?t?set?t.company_code=2?where?sequence_no=seqnos(i);
END;



普通方法:
begin
FOR?i?IN?1..1001?loop
update?err_usage_gprs?t?set?t.company_code=1?where?sequence_no=i;
end?loop;
end;