-- 系统例外:too_many_rows
set serveroutput on
declare
--定义变量
pename emp.ename%type;
begin
--查询所有10号部门的员工姓名
select ename into pename from emp where deptno=10;
exception
when too_many_rows then dbms_output.put_line('select into 匹配了多行--非法操作');
when others then dbms_output.put_line('其他例外');
end;
/
Too_many_rows:该例外表示select语句查询后,将多个记录赋值给一个变量。
举例:如图,查询时匹配了多个行,捕获进行提示。
系统例外之 too_many_rows
too_many_rows例外的捕获