create or replace procedure inserttestdata
(
   v_count        in   number,
   v_startuserid  in   varchar2,
   v_returnval    out  number )
as
   v_opertime           varchar2(20);
   v_current_count      number(10);
   v_temp_userid        varchar2(20);
begin
   v_opertime   := to_char(sysdate,'yyyy.mm.dd');
   v_current_count      := 0;
   v_temp_userid        := v_startuserid;
   
   while 1=1 loop 
   savepoint begin_tran;
   begin
      insert into ardinf(userid ,opertime)
       values(v_temp_userid ,v_opertime);
        exception
      when others then
      begin
         rollback to savepoint begin_tran;
         DBMS_OUTPUT.PUT_LINE('exception!');
         DBMS_OUTPUT.PUT_LINE(v_temp_userid);
         v_returnval := 1008;
         exit;
         --exit之后的代码无法执行
         DBMS_OUTPUT.PUT_LINE('After exit!Before return');
         DBMS_OUTPUT.PUT_LINE(v_returnval);
         return;
         DBMS_OUTPUT.PUT_LINE(v_returnval);
      end;
   end;
   if v_current_count >= v_count-1 then
      begin
          DBMS_OUTPUT.PUT_LINE('over and exit!'); 
          exit;
      end;
   end if;     
   commit;
   v_current_count:=v_current_count+1;
   v_temp_userid:=to_char(to_number(v_temp_userid)+1);
   if mod(v_current_count,10000)=0 then
      DBMS_OUTPUT.PUT_LINE(v_current_count); 
   end if;    
   end loop;
   commit;
   DBMS_OUTPUT.PUT_LINE(v_returnval);
   return;
end inserttestdata;