在用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标签的使用
最新推荐文章于 2024-06-04 23:56:50 发布