select A,B,C,D from 表如果没有搜到数据,则会自动跳入no_data_found异常但是我希望搜不到数据,可以接下来进入接下来的处理代码。怎么写呢 把异常no_data_found去掉会跳到更外面的exception,如果不写会弹出未定义的exception。
解决方案 »
- oracle查询时使用in出现列表中的最大表达式数为1000
- 推荐一款支持Oracle的sql编辑软件
- TNS-12560:TNS:协议适配器错误
- 无意间删除了一个数据库实例的文件导致创建数据库提示数据库未打开
- Oracle有没有base64编码函数?
- Oracle 中插入数据出错
- 急:关于主从表外键锁表的问题!
- 请教:如何在oracle中建立一个作业
- 继penitent,bzszp步步高升,再次祝贺黄山转换新工作,公喜!
- 如何安全转移我的数据文件?移出原来的目录,但仍在同一个系统中。
- c++读取oracle数据时,数据总共有160万余条,但读到120万条时出错
- oracle 字段非空时唯一的触发器怎么写?
..没有数据,但不报异常
else
..
end if;
begin
if ...then
else
..
exception when no_data_found
exits;
end if;
int_a number;
begin
begin
select a into int_a from taba where 1 = 2;
exception
when no_data_found or to_many_rows then
null;
end;
dbms_output.put_line(int_a);
end;
/
...
...
begin
select A,B,C,D into ... from 表;
exception
null;
end;...
...
exception WHEN OTHERS then
NULL;
--直接增加个匿名块 很方便
...begin
select A,B,C,D into ... from 表;
exception
when no_data_found then
null;
end;...
null;
exception WHEN OTHERS then
异常
int_a number;
begin
begin
select t.id into int_a from tttt t where 1 = 2;
exception
when no_data_found then
dbms_output.put_line('int_a='||int_a);
end;
dbms_output.put_line('int_a======='||int_a);
end;
/