oracle循环插入测试数据

ORACLE循环插入测试数据:

DECLARE v_num number(8):=2;v_index number(8):=1;v_name varchar2(255);v_code varchar2(15);
begin 
  while(v_index<=v_num)
  loop
    v_code:='000000000'||TO_CHAR(v_index);
    v_name:='name_'||SUBSTR(v_code,length(v_code)-7);
    
    insert into t_person(PERSON_NAME)
    VALUES(v_name);
    COMMIT;

    v_index:=v_index+1;
    END LOOP while_loop;
end;




你可能感兴趣的:(oracle)