您当前的位置: 首页 > 学无止境 > 心得笔记 网站首页心得笔记
oracle-递归函数
发布时间:2017-11-23 15:05:25编辑:雪饮阅读()
创建一个递归函数:
SQL> edit
Wrote file afiedt.buf
1 create function fact(i int) return int
2 is
3 total int :=0;
4 begin
5 if i>1 then
6 total :=i+fact(i-1);
7 return total;
8 else
9 return 1;
10 end if;
11* end;
SQL> /
测试:
SQL> select fact(220807) from dual;
FACT(220807)
------------
2.4378E+10
函数删除:
SQL> drop function fact;
Function dropped.
关键字词:oracle,递归
上一篇:oracle-存储过程与存储函数