• 主页
  • Oracle 基础和管理
  • Oracle 高级技术
  • Oracle 认证与考试
LuckyStar222 2012年05月17日
Oracel中如何跳出多层循环啊?新手,请大家帮帮忙啊!急
declare
v_param varchar2(1024);
v_sql varchar2(1024);
v_temp_fcID varchar2(32);
v_temp_sql varchar2(1024);
v_temp_fcNum number;
v_temp_fsName varchar2(256);
v_temp_fpSeq number;
v_temp_enID varchar2(32);
cursor cur_fcTable is
select fc.*
from t_p_fiberchain fc;

cursor cur_fcdTable(fcID varchar2) is
select fcdr.* from t_p_Fiberchaindetailroute fcdr
where fcdr.instancetype = 53
--and fcdr.sendorreciveflag = 1
and fcdr.fiberchain_id = fcID
order by fcdr.serial;

cursor cur_linkTable(fp_id varchar2) is
select pl.* from t_int_physiclink pl
where pl.aid = fp_id or pl.zid = fp_id;--物理链接
begin
dbms_output.enable(10000);
for v_fcCur in cur_fcTable loop
for v_fcdCur in cur_fcdTable(v_fcCur.id) loop
v_temp_sql := 'select fp.seq,fs.displayName from t_p_fiberpair fp,t_p_fibersegment fs where fp.fibersegment_id = fs.id and fp.id = ''' || v_fcdCur.INSTANCEID || '''';
execute immediate v_temp_sql into v_temp_fpSeq,v_temp_fsName;

v_temp_sql := 'select count(pl.id) from t_int_physiclink pl where pl.aid = '''|| v_fcdCur.INSTANCEID || ''' or pl.zid = '''|| v_fcdCur.INSTANCEID || '''';
--dbms_output.put_line(v_temp_sql);
execute immediate v_temp_sql into v_temp_fcNum;

if v_temp_fcNum = 0 then --不存在连接
dbms_output.put_line(v_fcCur.USERNAME || ',' || v_temp_fsName || ',' || v_temp_fpSeq);
exit;
else
for v_plCur in cur_linkTable(v_fcdCur.INSTANCEID) loop
if v_fcdCur.INSTANCEID = v_plCur.AID then
v_temp_enID := v_plCur.ZID;
elsif v_fcdCur.INSTANCEID = v_plCur.ZID then
v_temp_enID := v_plCur.AID;
end if;

v_temp_sql := 'select count(temp.fiberchain_id) from (select distinct fdr.fiberchain_id from t_p_fiberchaindetailroute fdr where fdr.instanceid = '''|| v_temp_enID ||''') temp';
execute immediate v_temp_sql into v_temp_fcNum;


if v_temp_fcNum >= 2 then
dbms_output.put_line(v_fcCur.USERNAME || ',' || v_temp_fsName || ',' || v_temp_fpSeq);
??
elsif v_temp_fcNum = 0 then
dbms_output.put_line(v_fcCur.USERNAME || ',' || v_temp_fsName || ',' || v_temp_fpSeq);
??
else
v_sql := 'select distinct fdr.fiberchain_id from t_p_fiberchaindetailroute fdr where fdr.instanceid = '''|| v_temp_enID || '''';
--dbms_output.put_line(v_sql);
execute immediate v_sql into v_temp_fcID;

if v_fcCur.id <> v_temp_fcID then
dbms_output.put_line(v_fcCur.USERNAME || ',' || v_temp_fsName || ',' || v_temp_fpSeq);
??
end if;
end if;
end loop;
--dbms_output.put_line(v_temp_fcID);
end if;
end loop;
end loop;
end;

如题,我如何在问号处跳出最里面的两层循环啊?
...全文
75 点赞 收藏 6
写回复
6 条回复

还没有回复,快来抢沙发~

发动态
发帖子
Oracle
创建于2007-09-28

6408

社区成员

5.4w+

社区内容

Oracle开发相关技术讨论
社区公告
暂无公告