DROP PROCEDURE IF EXISTS test_select; DELIMITER ;; CREATE PROCEDURE test_select () BEGIN DECLARE i int; set i=1; WHILE i<5 DO SELECT id FROM sys_user WHERE id = i; SET i=i+1; END WHILE ; commit; END;; call test_select ();