DECLARE
 FUNCTION compute_factorial(n IN NUMBER) RETURN NUMBER IS
 factorial NUMBER := 1;
 BEGIN
 IF n = 0 OR n=1 THEN
 RETURN 1;
 ELSE
 FOR i IN 2..n LOOP
 factorial := factorial * i;
 END LOOP;
 RETURN factorial;
 END IF;
 END;
 result NUMBER;
 BEGIN
 result := compute_factorial(5);
 DBMS_OUTPUT.PUT_LINE('Factorial: ' || result);
 END; 
by