• + 0 comments

    DELIMITER //

    CREATE PROCEDURE PrintStars() BEGIN DECLARE count INT DEFAULT 20;

    WHILE count > 0 DO
        SELECT REPEAT(' * ', count);
        SET count = count - 1;
    END WHILE;
    

    END //

    DELIMITER ;

    -- To execute the procedure: CALL PrintStars();