我在cursor中写了1段select 语句来得到一些需要的字段,然后用这些字段的值作为一些逻辑验证的必要条件,但是select 出来的某些必要条件字段可能为空,那么对于这1条纪录而言就会no_data_found 我想要让程序遇到no_data_found 就跳到下一条select 中去执行,该怎么写?
cursor c is
select a,b
from table_1 t1 ;
begin
for cur in c
loop
select i,m
into ii mm
from table_2 t2
where t2.column1=cur.a
and t2.column2=cur.b (cur.b 中的值可能为null)
dbms_output.put_line('=======显示消息=====');
end loop;
exception
...............
end;

最新回复
gavinhuang (2008-11-12 18:13:59)
if v_record.b is not null then
......
end if;
end loop;
exception
when NO_DATA_FOUND then
null;
[ 本帖最后由 gavinhuang 于 2008-11-12 18:15 编辑 ]
superrg (2008-11-12 18:29:19)
redneck_he (2008-11-12 22:40:49)
begin
for cur in c
loop
begin
select i,m into ii,mm from table_2 t2
where t2.column1=cur.a
and t2.column2=cur.b (cur.b 中的值可能为null)
exception when no_data_found then
goto continue;
end;
dbms_output.put_line('=======显示消息=====');
<<continue>>
end loop;
exception
...............
end;