循环随机变更数据库表中某个字段的值为指定的值
delimiter $
DROP PROCEDURE IF EXISTS pro1;
CREATE PROCEDURE pro1()
BEGIN
DECLARE i INT;
SET i = 1;
while i < 100 DO
UPDATE enterprise_inf SET STATUS='AA' WHERE id = (SELECT * FROM((SELECT ROUND(RAND()*((SELECT MAX(id) FROM enterprise_inf) - (SELECT min(id) FROM enterprise_inf))) + (SELECT MIN(id) FROM enterprise_inf)) as A));
SET i = i+1;
END WHILE;
END $
delimiter ;
call pro1();