CREATE PROCEDURE myproc() BEGIN DECLARE i int DEFAULT 237692001; WHILE i <= 237692004 DO INSERT INTO mytable (code, active, total) VALUES (i, 1, 1); SET i = i + 1; END WHILE; END DELIMITER; CALL myproc;