CREATE OR REPLACE FUNCTION fact(n number) RETURN NUMBER IS f number; i number; begin f:=1; i:=1; while(i<=n) loop f:=f*i; i:=i*1; end loop; return f; end fact; / declare n number; f number; begin n:='&number'; f:=factorial(n); dbms_output.put_line('factorial: '||f); end; /