create or replace procedure BATCH_INSERT_A (insertNo in integer) is n_id integer; /*************************** name:batch_insert_table_p purpose:--向A表批量插入数据 imput:--批量插入数据的数据量 output:n/a author:cici createdate: updatedate: ***************************/ begin SELECT MAX(ID) into n_id from a; if n_id is null then n_id:=0; end if; //begin for loop for i in n_id+1...n_id+insertNo loop dbms_output.put_line(‘NO is‘||i||‘NOW‘); dbms_output.put_line(‘Name is ‘||‘a‘||i||‘NOW‘); INSERT INTO A(name,id) values(‘a‘||i,i); end loop; end BATCH_INSERT_A;
/*另一种写法 declare v_num number; begin v_num:=1; while v_num!=20 loop insert into A(id,name) values(a_seq.nextval,‘a4‘); v_num:=v_num+1; end loop; end; */
时间: 2024-11-05 11:42:30