会计考友 发表于 2012-8-4 14:06:19

oracle认证辅导:批量插入测试数据

一、Test Windos方式   declare
  maxrecords constant int:=100000;
  i int :=1;
  begin
  for i in 1..maxrecords loop
  insert into test2
  (id, name)
  values
  (test2_seq.nextval, to_char(9999+i));
  end loop;
  dbms_output.put_line(' 成功录入数据!');
  commit;
  end;
  二、从已有表中往入另一张表导数据
  create or replace procedure TestProc is
  begin
  for c in(select id, name from test2) loop
  insert into test
  (id,
  name)
  values
  (test_seq.nextval, c.name);
  end loop;
  end TestProc;
页: [1]
查看完整版本: oracle认证辅导:批量插入测试数据