mysql stored procedure inserts and splices cyclically

#Table structure
CREATE TABLE `p_user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `userName` varchar(50) NOT NULL COMMENT 'Use email address/mobile phone number as user name',
  `nickName` varchar(50) DEFAULT NULL,
  `password` char(32) DEFAULT NULL COMMENT 'MD5 value',
  `randomKey` char(4) DEFAULT NULL,
  `gender` char(1) DEFAULT '0' COMMENT '0: unknown; 1: male; 2: female',
  `company` varchar(30) DEFAULT NULL,
  `jobTitle` varchar(30) DEFAULT NULL,
  `mobile` varchar(20) DEFAULT NULL,
  `telephone` varchar(30) DEFAULT NULL,
  `fax` varchar(30) DEFAULT NULL,
  `email` varchar(50) DEFAULT NULL,
  `national` varchar(40) DEFAULT NULL,
  `provinceId` int(11) DEFAULT NULL,
  `cityId` int(11) DEFAULT NULL,
  `address` varchar(200) DEFAULT NULL,
  `postCode` varchar(10) DEFAULT NULL,
  `brief` varchar(1024) DEFAULT NULL,
  `head` varchar(255) DEFAULT NULL,
  `addTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `lastModifyTime` timestamp NULL DEFAULT NULL,
  `status` char(1) NOT NULL DEFAULT '2' COMMENT '0: disabled, 1: verified, 2: unverified',
  `emailCheckCode ` varchar(32) DEFAULT NULL,
  `emailCheckTime` timestamp NULL DEFAULT NULL,
  `accessTime` timestamp NULL DEFAULT NULL COMMENT 'Last login time',
  `security` varchar(5) NOT NULL DEFAULT '1',
  `chatCreated` char(1 ) DEFAULT '0' COMMENT 'whether chat has been opened',
  `weChatId` varchar(50) DEFAULT NULL COMMENT 'WeChat',
  `channelId` varchar(50) DEFAULT NULL COMMENT 'Baidu Push',
  `receive` char(1) DEFAULT '' COMMENT 'Whether to receive demand or plan 1: receive 0: not receive',
  `weChat` varchar(20) DEFAULT NULL COMMENT 'WeChat',
  `greetSwitch` int(11) DEFAULT '1' COMMENT 'Greeting switch: 0: close 1: open',
  `greetContent` varchar (20) DEFAULT '1' COMMENT 'The content of the greeting',
  `tempMobile` varchar(20) DEFAULT NULL COMMENT 'Note: If the user clicks to exchange mobile phone numbers and does not want to exchange the current mobile phone number when filling in',
  `userSig` text COMMENT 'Login Tencent Cloud credentials',
  `reciveAllChat` char(1) DEFAULT '0' COMMENT '0: Accept 1: Not receive',
  `appRole` varchar(2) DEFAULT '8' COMMENT '8: Technical Demander 10: Technical provider',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=57215 DEFAULT CHARSET=utf8

#sql
CREATE PROCEDURE test_insert5 () 
BEGIN 

DECLARE i INT DEFAULT 58000; 
  #DECLARE usernames VARCHAR DEFAULT '科创号'; 

WHILE i<58300 
DO 
insert into p_user(id, userName,nickName,`password`,randomKey,addTime,`status`,security) VALUES (i,replace( i,'5','科创号5') ,replace( i,'5','科创号5'),'abc123','fkAB',NOW(),'1','1');

SET i=i+1; 

END WHILE ; 

commit; 

END;

call test_insert5 ();







DROP PROCEDURE if exists test_insert ; 

CREATE PROCEDURE test_insert () 
BEGIN 

DECLARE i INT DEFAULT 58000; 
  DECLARE usernames VARCHAR(20) DEFAULT "科创号"; 

WHILE i<58300 
DO 
insert into p_user_copy(id, userName,nickName,`password`,randomKey,addTime,`status`,security) VALUES (i,CONCAT(usernames,id),CONCAT(usernames,id),MD5(CONCAT(MD5('abc123'),'fkAB')),'fkAB',NOW(),'1','1');
SET i=i+1; 

END WHILE ; 

commit; 

END;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326446111&siteId=291194637