• + 0 comments

    For MySQL

    DELIMITER &&
    
    CREATE PROCEDURE printPattern()
    BEGIN
        DECLARE i INT DEFAULT 1;
        
        WHILE i<=20 DO
            SELECT IF(i=1, "*", REPEAT("* ", i));
            SET i = i+1;
        END WHILE;
    
    END&&
    
    DELIMITER ;
    
    CALL printPattern();