--简单循环
declare
c number(3):=1;
begin
loop
if mod(c,7)=0 then
dbms_output.put_line(c);
end if;
c:=c+1;
exit when c>100;
end loop;
end;
--FOR循环
begin
for x in (select level from dual where mod(level,7)=0 connect by level<=100 ) loop
dbms_output.put_line(x.level);
end loop;
end;
--while
declare
c number(3) := 1;
begin
while c <= 100 loop
if mod(c, 7) = 0 then
dbms_output.put_line(c);
end if;
c := c + 1;
end loop;
end;