这段时间在做一个业务,需要用到存储过程处理业务逻辑,但是出现一个ORA-01403: 未找到数据 问题,
那么这个应该如何解决这个问题
1declare mixType integer; 2begin 3 --原先获取方式-- 4 select NVL(MID,0) into mixType from DXC_MIXTYPE where Name='常温111' and RowNum=1; 5end;
如果根据条件找不到,是无法赋值到mixType中的

解决方法我采用这种处理方式
1declare mixType integer; 2begin 3 --默认如果找不到,默认给0值--- 4 select count(*) into mixType from DXC_MIXTYPE where Name='常温111' and RowNum=1; 5 if mixType>0 then 6 select NVL(MID,0) into mixType from DXC_MIXTYPE where Name='常温111' and RowNum=1; 7 end if; 8end;
Ps:
参考网址来源: https://blog.csdn.net/u010999809/article/details/80663895