调用存储过程出现ORA-01403: 未找到数据。高分求高手,急!!!!!

调用存储过程出现ORA-01403: 未找到数据。高分求高手,急!!!!!,第1张

注意select into 语句,如果不是从dual中取值,那么最好加上异常捕获。

如:

BEGIN

select a.c_reportcode, c.c_unitid

into cnb_vvarB, cnb_nvarF

from tb_org_unitrelation a, TB_CNB_NDJXINFO b,tb_inf_employee c

where b.c_empoid=c.c_oid

and a.c_orgunitid = c.c_unitid

and b.c_oid = to_number(cnb_vvarA)

EXCEPTION

WHEN NO_DATA_FOUND THEN

cnb_vvarB := 0

cnb_nvarF := 0

END

select count(*) into v_count from t_cxt

where hpzl = v_cxdm

if v_count >0 then

count(hpzl) 如果hpzl列为NULL的时候,是不会计入最后的count值的.除非你确定此列不会有NULL出现,要么就用 count(*),只要有这条数据就会计数的. 另外你原来使用的nvl函数没必要,count函数不会返回NULL的.

这几行代码中不会出现ORA-01403: no data found的,检查别处的代码吧

select x.cph, y.cxdm into v_cph, v_cxdm

from t_cxt_users x left join t_cxt_cxdm y on x.cxdm = y.dxdm

where x.mobile = i_srcaddr

检查这句SQL, 如果查询不到记录,这样的赋值会出异常, 建议select .... into 前判断一下


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/12164333.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-21
下一篇2023-05-21

发表评论

登录后才能评论

评论列表(0条)

    保存