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

解决方案 »

  1.   

    loop 中增加if else 进行判断~~~·~
      

  2.   

    用if else 或者用goto 
      

  3.   

    用IF else goto直接解决你的问题。希望能够帮到你吧
      

  4.   


    --原来是这样的
    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; 
      

  5.   

    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;
      

  6.   

    定义标签,然后使用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