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


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

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

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

如果根据条件找不到,是无法赋值到mixType中的

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

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:

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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM