mysql使用存储过程制造测试数据

DELIMITER $$  

DROP PROCEDURE IF EXISTS message_insert_procedure;  
CREATE PROCEDURE `test`.`message_insert_procedure` ( loop_times INT)  
BEGIN  
    DECLARE var INT DEFAULT 0;    
    WHILE var<loop_times DO    
    SET var=var+1;    
    INSERT INTO test.message (msg_id,content,type,creator_id,create_time)   
    VALUES (var,CONCAT(var,' - ','测试数据'),0,10013,now());    
    END WHILE;     
END  
 
--------------------调用的时候-------------------------------
use test;  
delete from message;  
call message_insert_procedure(10000000);  
posted @ 2017-02-21 09:52  AlamZ  阅读(2110)  评论(0编辑  收藏  举报