drop function if exists loopfunction // create function loopfunction() returns VARCHAR(50) begin declare l_loop int default 0; loop1: loop set l_loop := l_loop + 1; if l_loop < 11 then iterate loop1; end if; leave loop1; end loop loop1; return concat('We looped ',l_loop,' times.'); end //