oracle怎么提交存储 oracle 提交

Oracle存储过程,更新大量数据,如何循环分批次提交?可通过以下方法:
以100条数据为例,如果海量数据可参考 。
如test表中有如下数据:
现要将begintime改成当前时间,每10条提交一次 。
可用如下存储过程:
declare
i int;--定义变量
v_count int;--定义变量
v_loop int;--定义变量
begin
select count(*) into v_count from test;--计算表内数据总数
select ceil(v_count/10) into v_loop from dual;--计算需要循环次数
i:=1;--为i赋值
while i=v_loop loop--循环退出条件
update test set begintime=sysdate where begintime is null and rownum=10;--执行更新
commit;--提交
i:=i 1;--i依次加1
end loop;--结束循环
end;
oracle 存储过程提交数据一处简单的plsql匿名块就可以达到这个目的:
【oracle怎么提交存储 oracle 提交】begin
for i in 1..10000 loop
insert into t values(i);
if(mod(i,1000)=0) then commit;
end if;
end loop;
end;
Oracle中存储过程如何控制提交和回滚commit;--提交
EXCEPTION WHEN OTHERS THEN--如果出错
ROLLBACK;--回滚
关于oracle怎么提交存储和oracle 提交的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息 , 记得收藏关注本站 。

    推荐阅读