请问:在循环中,如果满足条件时,直接进入下一条循环的命令怎么写??就是红色字体那里!谢谢!
declare
i number :=1;
begin
for i in 1..10 loop
if i7 then
next record;[/COLOR]
else
dbms_output.put_line(i);
end if;
end loop;
end
CREATE OR REPLACE procedure mytestP as
i number :=1;
begin
for i in 1..10 loop
if i7 then
goto lab;
else
dbms_output.put_line(i);
end if;
>
null;
end loop;
end mytestP;
最初由 zhpsam 发布
[B]CREATE OR REPLACE procedure mytestP as
i number :=1;
begin
for i in 1..10 loop
if i7 then
goto lab;
else
dbms_output.put_line(i);
end if;
>
null;
end loop;
end mytestP;
为什么>后面要有:null;才可以编译通过? [/B]
for i in 1..10 loop
if i7 then
null;
else
dbms_output.put_line(i);
end if;
end loop;
直接这样就可以呀!
另一办法: 定义异常
declare
i number :=1;
val_exp exception;
begin
for i in 1..10 loop
begin
if i7 then
raise val_exp;
else
dbms_output.put_line(i);
end if;
exception when val_exp then null;
end;
end loop;
end