oracle数据库造测试数据,oracle创办测试数据

该博客分享了两个Oracle数据库的测试数据创建脚本,分别用于填充表`aa`和`bb`。脚本使用PL/SQL声明局部变量并进行循环插入,通过判断条件生成不同类型的测试数据,涉及字段包括客户编号、用户名、区域ID等多个字段。这些脚本对于数据库测试和开发环境的数据初始化非常有用。
摘要由CSDN通过智能技术生成

当前位置:我的异常网» 数据库 » oracle创办测试数据

oracle创办测试数据

www.myexceptions.net  网友分享于:2013-07-16  浏览:0次

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;

文章评论

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值