select tel into v_tel from user where ID=‘25’ ;
执行这句就出错,因为user 里面没有ID=25的数据,我想应该是取出空值啊,怎么就抱错啊?
Error 100: ORA-01403: 未找到数据
执行这句就出错,因为user 里面没有ID=25的数据,我想应该是取出空值啊,怎么就抱错啊?
Error 100: ORA-01403: 未找到数据
解决方案 »
- Oracle10g 想要查询指定表当天添加了那些数据
- PGA奇怪的现象
- 免费oracle性能优化的讲座(内存系列),有兴趣的同学可以来看下
- 利用Oracle的EXP命令导出问题
- ORACLE表字段多影响性能吗?
- 死连接SESSION的立即处理
- “企业版本40000美元每CPU,或者800美元每用户”是什么意思?
- 表空间已经设为只读了,drop table 还能执行成功,这正常么?
- Oracle存储过程多个SYS_REFCURSOR游标数据集怎么整合在一个SYS_REFCURSOR游标数据集里面
- 如何查看oracle11g在何时进行了表空间扩展
- 如何向存储过程传数组?
- ***Oracle存储过程是否能够直接返回游标类型?***
exception
when no_data_found then
v_tel := '-1';
用异常处理吧
select count(0) into v_temp from user where id = '25'
if v_temp <> 0 then
select tel into v_tel from user where ID=‘25’;
end if;
当然,你也可以使用上面说的捕捉异常
select tel into v_tel from user where ID=‘25’;
exception
when no_data_found then
v_tel := '-1';
end ;