ORA-01403:no data found 解決辦法

    背景:在一個存儲過程中,調用另一個存儲過程,其中有一句話是 select a into b from table;當查詢出來的a沒有數據時,這個時候就會拋出這個異常:ORA-01403:no data found 。

 

    解決辦法:

 

    1:捕獲異常,用exception when no_data_found then  處理一下。

 

    2.select count(*) field into var from table where ....

    增加一個count(*)即使沒有找到數據,也會返回0,而不是null。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章