mysql 存储过程

DROP PROCEDURE test_insert;
DELIMITER ;;  
CREATE PROCEDURE test_insert ()  
BEGIN  
  
DECLARE i INT DEFAULT 0;  
  
WHILE i<10000  
DO  
INSERT INTO iv_log   
(  
invoice_id,   
operator,   
operate_time, 
operator2,
operate_type  
)  
VALUES  
(  
 i,  
 concat('zhangsan',i),  
 '2014-4-1 11:03:03',
 concat('zhangsan',i),
'1'  
);  
SET i=i+1;  
END WHILE ;  
  
END;;  

CALL test_insert();

 

 

跟我学MySQL存储过程

 

 

你可能感兴趣的:(mysql)