f:= x * fact(x-1)如何工作?

问题描述 投票:0回答:2
declare
    num number;
    factorial number;

    function fact(x number)
       return number
    is
       f number;
    begin
       if x=0 then
          f := 1;
       else
          f := x * fact(x-1);
       end if;
       return f;
    end;

begin
    num:= 6;
    factorial := fact(num);
    dbms_output.put_line(' Factorial '|| num || ' is ' || factorial);
end;
/

f := x * fact(x-1)如何运作?像一个循环或什么?

oracle recursion plsql oracle11g
2个回答
© www.soinside.com 2019 - 2024. All rights reserved.