-
-
Save uncoded-ro/a573be722afc9ff0d94033c1aa1b2103 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DELIMITER | | |
DROP PROCEDURE IF EXISTS lefti.numerePare | | |
CREATE PROCEDURE lefti.numerePare(IN maxim INT) | |
BEGIN | |
DECLARE x INT; | |
DECLARE str VARCHAR(255); | |
SET x = 1; | |
SET str = ''; | |
loop1: LOOP | |
IF x > maxim THEN LEAVE loop1; | |
END IF; | |
SET x = x + 1; | |
IF x mod 2 != 0 THEN ITERATE loop1; | |
ELSE SET str = CONCAT(str, x, ', '); | |
END IF; | |
END LOOP; | |
SELECT str; | |
END | | |
DELIMITER ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment