CREATE DEFINER = `page_visitor_record` @`%` PROCEDURE `addTestData` () BEGIN DECLARE number INT; SET number = 1; WHILE number <= 100 #插入N条数据 DO UPDATE browse_statis_record SET staff_id = staff_id + id, staff_name = CONCAT( 'zhangsan(张三', id, ')' ) WHERE id IN ( SELECT t.id FROM ( SELECT * FROM browse_statis_record WHERE id > 480 AND staff_id = 159110 LIMIT 10 ) AS t ); SET number = number + 1; END WHILE; END
标签:存储,SET,END,number,WHILE,mysql,过程 From: https://www.cnblogs.com/siyunianhua/p/16975261.html