Mysql基础——存储过程创建表数据

delimiter $$
CREATE PROCEDURE i_employees_ptarc (IN row_num INT)
BEGIN

DECLARE i INT DEFAULT 0 ;
WHILE i < row_num DO
INSERT INTO employees_ptarc (v_int, v_string, s_string)
VALUES
(
floor(1 + rand() * 1000000),
substring(
MD5(RAND()),
1,
floor(1 + rand() * 20)
),
substring(MD5(RAND()), 1, 20)
) ;
SET i = i + 1 ;
END
WHILE ; END$$

delimiter ;

call i_employees_ptarc(400000);
/***存储过程***/

 

posted on 2024-05-08 19:46  gkhost  阅读(24)  评论(0编辑  收藏  举报

导航