校验1万行的一个数据表,希望每校验100行就输出一下进度。
if mod(v_count,100) = 0 then
commit;
DBMS_OUTPUT.put_line(v_count);
end if;
用这个语句的结果是存储过程执行完一下子输出所产生的所有结果。
并不是每100条一输出。
不知道如何解决,求助。
if mod(v_count,100) = 0 then
commit;
DBMS_OUTPUT.put_line(v_count);
end if;
用这个语句的结果是存储过程执行完一下子输出所产生的所有结果。
并不是每100条一输出。
不知道如何解决,求助。
http://topic.csdn.net/u/20081030/13/fe96635c-fa7c-42e5-8bc1-f60bd68a8b44.html最后我使用的办法是执行中途用utl_file写日志,
自治事务整复杂了,不好用
create table process(total number, curr number);
其中的total是总行数,curr是当前执行到的行数.下面是更新当前进度的子程序,由于是自治事务,所以不会影响调用程序的事务.create or replace procedure get_process(p_count in number)
as
PRAGMA AUTONOMOUS_TRANSACTION;
begin
update process set curr = p_count;
commit;
end;
/
下面开始调用get_process
begin
insert into process(total) values(10000);
for i in 1..10000 loop
if mod(i,100) = 0 then
commit;
get_process(i);
end if;
end loop;
end;
/