Oracle标签的使用

在用Code Xpert扫描代码时,提示“Avoid unlabeled nested LOOPs”.
即避免使用没有标签的嵌套循环。
那么标签是怎么使用的呢?
看下面的例子:

procedure test_label is
            cursor mycursor is
                  select t.trustee from xxxt where rownum <= 10;
            v_list mycursor%rowtype;
      begin
            open mycursor;
            <<a>>
            loop
                  fetch mycursor
                        into v_list;
                  exit when mycursor%notfound;
                  dbms_output.put_line(v_list.trustee);
            end loop a;
            close mycursor;
      
            <<la>>
            for i in 1 .. 9
            loop
                  <<lb>>
                  for j in 1 .. i
                  loop
                        dbms_output.put(i || '*' || j || '=' || i * j ||
                                        '    ');
                  end loop lb;
                  dbms_output.new_line();
            end loop la;
      exception
            when others then
                  dbms_output.put_line('errorCode:' || sqlcode ||
                                       ',errorInfo:' || sqlerrm);
      end test_label;



你可能感兴趣的:(oracle)