oracle 使用 dbms_lock.sleep暂停存储过程执行

grant execute on dbms_lock to USERNAME;

 

dbms_lock.sleep(time)参数单位为秒

 

create or replace procedure initdata is

num number := 0;

begin

 

for i in 1 .. 500 loop

 

num := num + 1;

if num >= 1000 then

dbms_lock.sleep(5);

num := 0;

dbms_output.put_line('暂停5秒');

 

end if;

end loop;

 

end initdata;

posted on 2014-08-07 17:32  nami  阅读(7372)  评论(0编辑  收藏  举报