首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

PL/SQL中循环不满足条件如何跳出当前循环继续

2012-06-28 
PL/SQL中循环不满足条件怎么跳出当前循环继续PL/SQL中循环不满足条件怎么跳出当前循环继续就是像Java中一

PL/SQL中循环不满足条件怎么跳出当前循环继续
PL/SQL中循环不满足条件怎么跳出当前循环继续 就是像Java中一样 不满足条件 break 但是可以继续循环

[解决办法]
loop 中增加if else 进行判断~~~·~
[解决办法]
next关键字可以解决你的问题
[解决办法]
用if else 或者用goto
[解决办法]
用IF else goto直接解决你的问题。希望能够帮到你吧
[解决办法]

SQL code
--原来是这样的loop  select col into v_col from tbname ;end loop ;--改成这样的,就会把异常吃掉了,但是别忘了异常处理,起码也应该记录一下吧.loop  begin    select col into v_col from tbname ;  exception     when no_data_found then       --exception handle     when value_error then      --exception handle  end ;end loop;
[解决办法]

SQL code
loop  begin    select col into v_col from tbname ;  exception     when no_data_found then       --exception handle     when value_error then      --exception handle    when other then      --exception handle  end ;end loop;
[解决办法]
定义标签,然后使用goto,列子如下:
declare
nT integer;
begin
-- <<label_name>>
nT := 0;
<<label_1>>
loop
if(nT > 100) then
exit;
end if;
nT := nT + 1;
if(mod(nT,2)=1) then
goto label_1;
end if;

dbms_output.put_line(nT);
end loop;
end;

在11g中貌似实现了continue
[解决办法]
goto 就可以了

热点排行