Recursion : Recursive Functions « Function Procedure Packages « Oracle PL/SQL Tutorial






SQL>
SQL> create or replace function factorial (i NUMBER)
  2  return NUMBER
  3  is
  4  begin
  5      if i = 1
  6      then
  7          return 1;
  8      else
  9          return i*factorial(i-1);
 10      end if;
 11  end;
 12  /

Function created.








27.4.Recursive Functions
27.4.1.Recursion
27.4.2.Recursive functions