SQL> declare
2 v_ename emp%rowtype;
3 begin
4 select * into v_ename from emp where empno=-1;
5 if sql%notfound then
6 dbms_output.put_line('sql%notfound is true!');
7 end if;
8 exception
9 when no_data_found then
10 dbms_output.put_line('NO_DATA_Found is true!');
11 end;
12 /
PL/SQL procedure successfully completed.
SQL> /
PL/SQL procedure successfully completed.
SQL> set serveroutput on
SQL> /
NO_DATA_Found is true!
PL/SQL procedure successfully completed.
SQL>
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29987/viewspace-51740/ ,如需转载,请注明出处,否则将追究法律责任。