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;


« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3