MySQL存储过程,生成大量数据

MySQL存储过程,生成大量数据

2014年10月16日17:29:40

BEGIN 
DECLARE ID INT; 
DECLARE i INT; 
DECLARE CARDID VARCHAR(16);
DECLARE IssuerID VARCHAR(16);
DECLARE ObuID VARCHAR(16);
DECLARE License VARCHAR(25);
DECLARE strID VARCHAR(2);
DECLARE strTmp1 VARCHAR(3);
DECLARE strTmp2 VARCHAR(3);
DECLARE strTmp3 VARCHAR(3);
DECLARE NetNo VARCHAR(4);
DECLARE LicenseName VARCHAR(4);
DECLARE LicenseNameA VARCHAR(4);
DECLARE LicenseNameB VARCHAR(4);
SET ID = 11;
SET LicenseName = '京';
SET strID = RIGHT(CONCAT('00',cast(ID as char(2))),2);
SET i=0; 
set strTmp1 = '1';
SET strTmp1 = CONCAT(strID,'1');
SET strTmp2 = CONCAT(strID,'2');
SET strTmp3 = CONCAT(strID,'3');
SET NetNo = CONCAT(strID,'01');
SET LicenseNameA = CONCAT(LicenseName,'A');
SET LicenseNameB= CONCAT(LicenseName,'B');

WHILE i<100000 DO 
SET CARDID	= CONCAT(strTmp1,RIGHT(CONCAT('0000000000000',cast(i as char(16))),13));
SET IssuerID	= CONCAT(strTmp2,RIGHT(CONCAT('0000000000000',cast(i as char(16))),13));
SET ObuID	= CONCAT(strTmp3,RIGHT(CONCAT('0000000000000',cast(i as char(16))),13));
SET License	= CONCAT(LicenseNameA,RIGHT(CONCAT('00000',cast(i as char(16))),5));
#SET CARDID	= CONCAT('0847',cast(i as char(12)));
INSERT INTO `ETCBlackList11` VALUES (IssuerID, NetNo, CARDID, ObuID, License, '0', '0', '2000-01-01 00:00:00', '1', '2000-01-01 00:00:00', '测试', '16019', '0', '0', '0', null);
SET i = i + 1; 
END WHILE; 

WHILE i<200000 DO 
SET CARDID	= CONCAT(strTmp1,RIGHT(CONCAT('0000000000000',cast(i as char(16))),13));
SET IssuerID	= CONCAT(strTmp2,RIGHT(CONCAT('0000000000000',cast(i as char(16))),13));
SET ObuID	= CONCAT(strTmp3,RIGHT(CONCAT('0000000000000',cast(i as char(16))),13));
SET License	= CONCAT(LicenseNameB,RIGHT(CONCAT('00000',cast(i as char(16))),5));
#SET CARDID	= CONCAT('0847',cast(i as char(12)));
INSERT INTO `ETCBlackList11` VALUES (IssuerID, NetNo, CARDID, ObuID, License, '0', '0', '2000-01-01 00:00:00', '1', '2000-01-01 00:00:00', '测试', '16019', '0', '0', '0', null);
SET i = i + 1; 
END WHILE; 
END


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值