oracle存储过程出现ORA-01403: 未找到数据 问题解决方法

这段时间在作一个业务,须要用到存储过程处理业务逻辑,可是出现一个ORA-01403: 未找到数据 问题,spa

那么这个应该如何解决这个问题.net

declare mixType integer;
begin
   --原先获取方式--
   select NVL(MID,0) into mixType from DXC_MIXTYPE where Name='常温111' and RowNum=1;
end;

若是根据条件找不到,是没法赋值到mixType中的code

解决方法我采用这种处理方式blog

declare mixType integer;
begin
  --默认若是找不到,默认给0值---
  select count(*) into mixType from DXC_MIXTYPE where Name='常温111' and RowNum=1;
  if mixType>0 then
    select NVL(MID,0) into mixType from DXC_MIXTYPE where Name='常温111' and RowNum=1;
  end if; 
end;

Ps:class

参考网址来源: https://blog.csdn.net/u010999809/article/details/80663895select

相关文章
相关标签/搜索