Skip to content

Instantly share code, notes, and snippets.

@Foadsf
Created March 27, 2020 12:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Foadsf/7dcefc25d70a8f9147d10ce2ed881721 to your computer and use it in GitHub Desktop.
Save Foadsf/7dcefc25d70a8f9147d10ce2ed881721 to your computer and use it in GitHub Desktop.
MySQL While Loop
SET @year = 2020;
DELIMITER $$
DROP PROCEDURE IF EXISTS reapeatEvent;
CREATE PROCEDURE reapeatEvent()
BEGIN
WHILE (@year < 2030) DO
SET @year = @year + 1;
END WHILE;
END; $$
DELIMITER ;
CALL reapeatEvent();
SELECT @year;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment