部分代码
cursor b1 is
select * from ec_acc_fee e where e.line_code = lineCode;
b b1%rowtype; cursor b2 is
select * from ec_acc_fee e where e.user_code = userCode;
begin
open d1;
open d2;
LOOP
if userCode is null then
FETCH d1
INTO d;
Exit When d1%Notfound;
elsif lineCode is null then
FETCH d2
into d;
dbms_output.put_line('DDDD');--这里能打印
Exit When d2%Notfound;
end if;
dbms_output.put_line('EEEE');为什么这里却不能打印
end loop;
end;
cursor b1 is
select * from ec_acc_fee e where e.line_code = lineCode;
b b1%rowtype; cursor b2 is
select * from ec_acc_fee e where e.user_code = userCode;
begin
open d1;
open d2;
LOOP
if userCode is null then
FETCH d1
INTO d;
Exit When d1%Notfound;
elsif lineCode is null then
FETCH d2
into d;
dbms_output.put_line('DDDD');--这里能打印
Exit When d2%Notfound;
end if;
dbms_output.put_line('EEEE');为什么这里却不能打印
end loop;
end;
写成for cur in(select ...)loop
形式吧,比较清晰一些
2。d2这个查询有数据么?[Exit When d2%Notfound; ]这个跳出循环了。都EndLoop了当然打不出来东西了
--类似的存储过程
create or replace procedure aa
is
vtime varchar2(100);
cursor cur is select 1 from dual;
begin
open cur;
loop
if 1=1 then
fetch cur into vtime;
dbms_output.put_line('aa');
exit when cur%NOTFOUND;
end if;
dbms_output.put_line('bb');
end loop;end;