1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | DELIMITER $$ CREATE PROCEDURE HOUSECHARID() BEGIN DECLARE a INT DEFAULT 200000 ; #declare stating house_id here (also USE FOR loop) DECLARE b INT DEFAULT 200000; #declare stating char_id here simple_loop: LOOP SET a=a+1; INSERT INTO `char`(char_id,account_id,name) VALUES(b+a,0,concat("House",a)); IF a>200 THEN #limit LEAVE simple_loop; END IF; END LOOP simple_loop; END $$ |