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