1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| DROP PROCEDURE IF EXISTS proc_initData; DELIMITER $
CREATE PROCEDURE proc_initData () BEGIN
DECLARE i INT DEFAULT 1 ; WHILE i <= 10000 DO INSERT INTO plan ( NAME, user_id, domain, category, description, install_times, like_times, recommend, recommend_reason, logo, ctime, mtime, isvalid, status ) VALUES ( concat("方案", i), floor(1 + rand() * 10000000), floor(1 + rand() * 4), floor(1 + rand() * 2), concat("分享理由", i), floor(1 + rand() * 100), floor(1 + rand() * 1000), floor(0 + rand() * 1), concat("推荐理由", i), concat("logo", i), now(), now(), 1, floor(0 + rand() * 2) ) ; SET i = i + 1 ; END WHILE ; END$
CALL proc_initData () ;
|