Oracle批量生成测试数据方法

发表于:2008-7-24 16:58

字体: | 上一篇 | 下一篇 | 我要投稿

 作者:tony sing    来源:CSDNBLOG

  一、Test Windos方式

declare
        maxrecords constant int:=1000;
        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;

《2023软件测试行业现状调查报告》独家发布~

关注51Testing

联系我们

快捷面板 站点地图 联系我们 广告服务 关于我们 站长统计 发展历程

法律顾问:上海兰迪律师事务所 项棋律师
版权所有 上海博为峰软件技术股份有限公司 Copyright©51testing.com 2003-2024
投诉及意见反馈:webmaster@51testing.com; 业务联系:service@51testing.com 021-64471599-8017

沪ICP备05003035号

沪公网安备 31010102002173号