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


在存储过程中select column into t_prop 。。。

当查询不到值的时候会报错,这时候的处理方法为:

使用聚合函数,比如:

  1. create or replace procedure test is  
  2. t_prop varchar2(20);  
  3. begin  
  4.          select max(sales_no) into t_prop from sales_card where 1=2;  
  5. end test;  
即可。

当然也要根据业务确定是否需要这样的数据

更多Oracle相关信息见Oracle 专题页面 http://www.bkjia.com/topicnews.aspx?tid=12

相关内容