mysql创建函数

CREATE FUNCTION fun1()
RETURNS INT
BEGIN
	DECLARE num INT ;
	DECLARE i INT ;
	set num = 10000;
	set i = 2;
	WHILE i<=10000 DO
		INSERT INTO student(`name`) VALUES(CONCAT('用户',i));
		set i=i+1;
	END WHILE;
	RETURN i;

END

SELECT fun1()

posted @ 2022-03-09 23:58  弩哥++  阅读(132)  评论(0编辑  收藏  举报