Answers for "mysql factorial stored procedure example"

SQL
1

mysql factorial stored procedure example

delimiter //
CREATE PROCEDURE fact(IN x BIGINT)
BEGIN
DECLARE result BIGINT;
DECLARE i BIGINT;
SET result = 1;
SET i = 1;
WHILE i <= x DO
SET result = result * i;
SET i = i + 1;
END WHILE;
SELECT x AS Number, result as Factorial;
END//
delimiter ;
Posted by: Guest on December-01-2020

Code answers related to "mysql factorial stored procedure example"

Code answers related to "SQL"

Browse Popular Code Answers by Language