USE test
DELIMITER $$
DROP PROCEDURE IF EXISTS example1$$
CREATE PROCEDURE example1()
BEGIN
  DECLARE x0,x1,i INT;
  SET x0 = 0;
  SET x1 = 1;
  SET i = 0;
  REPEAT
    SELECT x1; -- print the next fibonacci number
    SET x1 = x0 + x1;
    SET x0 = x1 - x0;
    SET i = i + 1;
  UNTIL i >= 20
  END REPEAT;
END $$
DELIMITER ;
call example1();


