declare @sum bigint,@count int
創(chuàng)新互聯(lián)公司專注于蚌埠網(wǎng)站建設服務及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗。 熱誠為您提供蚌埠營銷型網(wǎng)站建設,蚌埠網(wǎng)站制作、蚌埠網(wǎng)頁設計、蚌埠網(wǎng)站官網(wǎng)定制、微信平臺小程序開發(fā)服務,打造蚌埠網(wǎng)絡公司原創(chuàng)品牌,更為您提供蚌埠網(wǎng)站排名全網(wǎng)營銷落地服務。
select @sum=1,@count=1
label:
select @sum=@sum*@count
select @count=@count +1
if @count =20
goto label
select @sum
這個是sql的 1到20的階乘 count少于15可以直接定義@sum int 大于的話會算數(shù)溢出
select rownum rn, dbms_aw.eval_number(replace(wmsys.wm_concat(rownum)over(order by rownum), ',', '*')) serial_multi
2 from dual connect by rownum =6;
可以參照
10的階乘
簡單(loop)循環(huán)
1 declare
2 i number(2) :=1;
3 s number(10):=1;
4 name varchar(8):=' simple';
5 begin
6 loop
7 s:=s*i;
8 i:=i+1;
9 dbms_output.put_line(s||''||name);
10 exit when i10;
11 end loop;
12* end;
---------------------------------------------------可愛的分割線(臉紅)--------------------------------------------------------
for循環(huán)
1 declare
2 i number(2) :=1;
3 s number(10):=1;
4 name varchar(8):=' for';
5 begin
6 loop
7 s:=s*i;
8 i:=i+1;
9 dbms_output.put_line(s||''||name);
10 end loop;
11* end;
SQL /
1 for
2 for
6 for
24 for
120 for
720 for
5040 for
40320 for
362880 for
3628800 for
---------------------------------------------------可愛的分割線(臉紅)--------------------------------------------------------
while循環(huán)
1 declare
2 i number(2) :=1;
3 s number(10):=1;
4 name varchar(8):=' while';
5 begin
6 while i=10 loop
7 s:=s*i;
8 i:=i+1;
9 dbms_output.put_line(s||''||name);
10 end loop;
11* end;
SQL /
1 while
2 while
6 while
24 while
120 while
720 while
5040 while
40320 while
362880 while
3628800 while
網(wǎng)頁題目:oracle如何實現(xiàn)階乘,oracle累乘函數(shù)
瀏覽路徑:http://chinadenli.net/article34/hddhpe.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供云服務器、建站公司、標簽優(yōu)化、服務器托管、商城網(wǎng)站、App開發(fā)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容