日期:2014-05-16  浏览次数:20483 次

oracle创建测试数据
-- Created on 2011-10-21 by WKF46214
declare
  -- Local variables here
  num integer;
  islargeacct number(1);
  clientnum number(2);
begin
  -- Test statements here
  num:=1000000;
  clientnum:=0;
  for n in 1..num loop
      if mod(n,2)=0 then
         islargeacct:=0;
      else islargeacct:=1;
      end if;
      clientnum:=clientnum+1;
      if (clientnum=20) then
         clientnum:=0;
      end if;
    insert into aa(id, islargeacct, internetusername, clientnum, ismonitor, receiveflag, modifytime, regionid, custname, custtype, usertype, serviceid, servicetype, servicestatus, custindustrytype, professiontype, custlevel, rate, installaddress, accesstype, connectiontype, adsltype, xdsltype, supportbusinesstype, areacode, accessnbr, firstcompletetime, updatetime, pcts, xfzh, sbxh, sbbh, sbdzh, ypdzh, ssfj, ssjd, khjl, lxdh, recv1, recv2, recv3, recv4, recv5, recv6, recv7, recv8, recv9, recv10)
    values(n, islargeacct, 'user_'||n, clientnum, 0, 0, '20111021143000', 310001, 'CustName_'||n, 1, 0,
           0, 0, 0, 0, 0, 0, 0,
           '0', 0, 0, 0, 0, 0, '',
           '', '', '', '0', '0', '0', '0', '0', '0', '0', '0',
           '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0'
           );
  end loop;
  commit;
end;

------------------
declare
coun number(16);
one number(5);
aa  varchar(1);
bb varchar(1);
begin
coun:=10000000;
one:=1001;
  aa:='a';
  bb:='1';
  for n in 1..coun loop
 
  if mod(n,2)=0 then
   one:=1001;
   aa:='a';
    bb:='2';
  end if;
   if mod(n,3)=0 then
   one:=1002;
    aa:='b';
     bb:='3';
  end if;
   if mod(n,5)=0 then
   one:=1003;
    aa:='c';
     bb:='4';
  end if;
  if mod(n,7)=0 then
   one:=1004;
    aa:='d';
     bb:='5';
  end if;
  if mod(n,9)=0 then
   one:=1005;
    aa:='e';
     bb:='6';
  end if;
 
  insert into bbvalues (n||'',one,n,'GX_'||n,bb,aa);
  end loop;
  commit;
end;