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;
如题,我如何在问号处跳出最里面的两层循环啊?
------解决方案--------------------
最简单的 goto
------解决方案--------------------
最简单的 goto啊
------解决方案--------------