且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Oracle PL/SQL-使用"SELECT INTO"时,ORA-01403“未找到数据"

更新时间:2022-03-24 22:32:09

只需用begin-end;

begin 

    -- your faulty statement here
Exception
When NO_DATA_FOUND Then
    -- Do what you want or nothing 
WHEN TOO_MANY_ROWS THEN
    -- what if you get more then one row? and need specific handler for this 
When OTHERS Then
    -- do something here or nothing (optional - may happen if you have more than your SELECT INTO between 'begin' and 'Exception')

end;

这就像PL/Sqltry

使用这种技术,您可以记录语句失败的原因.

With this technique you can log the reason your statement failed.