忘了說了,用nvl(qty,0),執行是可以執行,但在程序中就能不過了,應該還是oracle發生了錯誤。但怎麼解決呢?
解决方案 »
- 查询两张表中的字段,在线等
- 各位高手帮忙看看这样的SQL语句怎么样在ORACLE中实现
- 救命~~~~~~禁用一个类型为PRIMARY的约束条件,报錯~!~~~~
- create的问题
- 关于Oracle安装配置问题!
- 那里可下载:《ORACLE8 PL/SQL程序设计》?
- 各位大侠:如何在IBM x250带阵列柜的双机热备份系统上安装Oracle817?
- 文件在那里
- 碰到一个棘手存储过程拼接字符串的问题
- oracle 11g(11.2.0.1.0)执行一个sql,导致连接断开
- 请问如何用存储过程返回一个查询的结果集,先谢谢,
- truncate table report;这条语句在存储过程中怎么过不去,急!
select qty into b1...;
exception when no_data_found then
...;
end;
如果语句返回的结果是没有找到记录时,那就谈不上了。
begin
select nvl(qty,0) into b1 from aaa where ...;
exception when no_data_found then
raise_application_error( -20451, '无记录: '|| SQLERRM )
end;
fetch xxx into a1begin
select qty into b1
from ...
where ....
exception when no_data_found then
b1:=0;
end;if a1=b1 then ....end loop正是楼上几位所说的.
from ...
where ....
或者
select qty into b1
from ...
where .... exception
when others then
bl:=0;
在过程中找不着值是要用when no_data_found 来捕获的,它不等于值为null。
而对于找到了值且值为null可以用nvl函数。