No_data_found exception for PL/SQL

a definition

The No_data_found exception is raised when the query data is not found.
Two examples
  1. --系统例外:no_data_found
  2. set serveroutput on
  3. declare
  4. pename emp.ename%type;
  5. begin
  6. --查询员工号时1234的员工的姓名
  7. select ename into pename from emp where empno =1234;
  8. exception
  9. when no_data_found then dbms_output.put_line('没有找到该员工');
  10. when others then dbms_output.put_line('其他例外');
  11. end;
  12. /
Three running results
The employee was not found

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326186572&siteId=291194637