DELIMITER $$ CREATE OR REPLACE DEFINER=`root`@`localhost` PROCEDURE `srt`.`randomMoving_Launch`() BEGIN DECLARE i INT DEFAULT 5; IF (SELECT count(*) FROM srt.moving) < 5 AND (SELECT isRandomMoving FROM srt.config) THEN WHILE i DO SET i = i - 1; -- CALL srt.randomMoving(22,35); CALL srt.randomMoving(2,5); END WHILE; END IF; END$$ DELIMITER ;