ORACLE1.23 loop,whild.for循环
1.条件呢?
--Basic
loop
...
end loop;
declare
i number:= 1;
begin
i:=100;
loop
i:= i + 1;
dbms_output.put_line(i);
if i>10 then
exit;
end if;
end loop;
end;
------------------
-->>变得更像一个PL/SQL程序员
--(这条是核心):先干再说
declare
i number:= 1;
begin
loop
i:= i + 1;
dbms_output.put_line(i);
exit when i>=10;
end loop;
end;
---------------------
-- 跟java一样,但是不常用
declare
i number:= 1;
begin
while i<=10 loop
dbms_output.put_line(i);
i:= i + 1;
end loop;
end;
--------------------
var j number;
begin
:j:=1;
while :j<=10 loop
dbms_output.put_line(:j);
:j:= :j + 1;
end loop;
end;
------------------
for loop
end loop;
------------------
declare
i number;
begin
i:= 5;
for i in 1..10 loop
dbms_output.put_line(i);
end loop;
dbms_output.put_line('i的值:'||i);
end;