oracle构造数据的存储过程://其中涉及的参数i、表名、表字段根据实际需要进行修改
DECLARE --声明函数
i INT;
BEGIN
i:=1000;
WHILE(i<6000)
LOOP --设置loop循环
i:=i+1;
insert into t_play_list (PLAYLIST_ID, BITRATE, JSON, START_INDEX, CREATE_TIME, VOLUME_NAME, START_NPT)
values (i, ‘3750‘, ‘{"smil":{"head":"","body":{"seq":{"video":[{"@attributes":{"id":"‘||i||‘","author":"coship","clip-begin":"npt=0.0s","clip-end":"npt=1813s","trickModeDisable":""}}]}}},"retCode":"0"}‘, 1, to_date(‘30-05-2018 11:16:32‘, ‘dd-mm-yyyy hh24:mi:ss‘), ‘coship‘, 0.00);
END LOOP;
COMMIT; --循环执行完后进行提交
END;
mysql构造数据存储过程://其中涉及的参数i、表名、表字段根据实际需要进行修改
DROPPROCEDUREIFEXISTSinsertt;#如果存在储存过程则删除
DELIMITER$$#创建一个储存过程
CREATEPROCEDUREinsertt()
BEGIN
SET@a=1;
SET@d=8000000000000000;
SET@c=6000;
WHILE@a<=2000000DO
INSERTINTOonline_user_info(ID,JID,LOGIN_CODE,TYPE,STB_TYPE,AREA_CODE,PORT,IP,HEARTBEAT_TIME,MES_IP)VALUES
(@a,CONCAT(@d,‘@coship-mes.com/STB‘),@d,‘1‘,‘2‘,‘0755‘,‘6666‘,‘80.9.107.1‘,‘1482402708000‘,‘172.21.13.76‘);
SET@a=@a+1;
SET@d=@d+1;
SET@c=@c+1;
ENDWHILE;
END$$
DELIMITER;
callinsertt();
原文地址:https://www.cnblogs.com/LBeautiful/p/10579117.html