plsql中取得5500条数据,每次最大处理1000条,算法咋么实现呢?

no no no 不是去前1000条,而是循环操作,需要把5500条数据都做处理,只是每次最多能提交1000条数据,好吗?

用个存储过程,轻松实现。

主要思路:
1.定义一个游标,取出5500条记录。
2.定义循环,每次处理1000条数据,提交,
3.结束。
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-08-11
declare
i number:=0;
begin

for rec in (select * from cux_xxxx) loop--select * from cux_xxxx为你的5500条数据

--你的操作
insert ...
update...
--你的操作.end
i :=i+1;
--每1000条保存一次,到最后剩下500条也保存一次
if i mod 1000 in (0,500) then
commit;
end if;
end loop;
end;
第2个回答  2012-08-02
select top 1000 * from table
相似回答