declare
e_no_employee exception;
pragma exception_init(e_no_employee,-2291);
v_empno number(4):=1111 ;
begin
while v_empno<=2222
loop
update scott.emp set deptno = 10
WHERE empno = v_empno;
if SQL%NOTFOUND THEN
BEGIN
v_empno:=v_empno + 1;
RAISE e_no_employee;
END;
END IF;
EXCEPTION
WHEN e_no_employee THEN
DBMS_OUTPUT.PUT_LINE('该雇员不存在!');
end loop;
end;
/