PLSQL select into为空的时候报错的处理方法

2014-11-24 08:56:02 · 作者: · 浏览: 1

PLSQL select into为空的时候报错的处理方法
在存储过程中select column into t_prop 。。。
当查询不到值的时候会报错,这时候的处理方法为:
使用聚合函数,比如:
[sql]
create or replace procedure test is
t_prop varchar2(20);
begin www.2cto.com
select max(sales_no) into t_prop from sales_card where 1=2;
end test;
即可。
当然也要根据业务确定是否需要这样的数据
摘自 yangaming的专栏