loop oracle

create table testins (a number);
 alter table testins add constraint pk_a primary key (a);
 set timing on
 create or replace procedure xyz is
    i 	number;
 begin
    for i in 1 .. 20000 loop
       begin 
          insert into testins values (1);
       exception
          when dup_val_on_index then null;
       end;
    end loop;
 end xyz;
 /
 exec xyz 

你可能感兴趣的:(数据库,sql,mysql)