declare
cursor mycursor
select * from a;
begin
open mycursor;
loop
fetch mycursor into 变量
exit when mycursor%notfound;
if... then...
else
...
end if;
end loop;
close mycursor;
end;
/
7.用FOR循环写出求10!算法
SQL> declare
2 num number:=1;
3 begin
4 for i in 1..10 loop
5 num:=num*i;
6 end loop;
7 dbms_output.put_line(num);
8 end;
9 /
3628800PL/SQL procedure successfully completed
cursor mycursor
select * from a;
begin
open mycursor;
loop
fetch mycursor into 变量
exit when mycursor%notfound;
if... then...
else
...
end if;
end loop;
close mycursor;
end;
/
7.用FOR循环写出求10!算法
SQL> declare
2 num number:=1;
3 begin
4 for i in 1..10 loop
5 num:=num*i;
6 end loop;
7 dbms_output.put_line(num);
8 end;
9 /
3628800PL/SQL procedure successfully completed
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货