User Tools

Site Tools


kurs:p_raise_exception

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

kurs:p_raise_exception [2014/09/10 21:22]
kurs:p_raise_exception [2014/09/10 21:22] (current)
Line 1: Line 1:
 +<​code>​
 +PROCEDURE P_RAISE_EXCEPTION
 +   ( v_last_name IN varchar2,
 +     ​v_salary ​   IN number)
 +   IS
 +  zuviele_personen exception;
 +BEGIN
 +  update employees
 +    set salary = v_salary
 +    where last_name = v_last_name;​
  
 +  if SQL%ROWCOUNT>​1 then
 +    raise zuviele_personen;​
 +  end if;
 +--  commit;
 +  EXCEPTION
 +    WHEN zuviele_personen THEN
 +      rollback;
 +      dbms_output.put_line('​zuviel Personen'​);​
 +      raise_application_error(-20001,​ 'ganz furchtbar',​ TRUE);
 +    when others then
 +      rollback;
 +END; -- Procedure
 +</​code>​
kurs/p_raise_exception.txt ยท Last modified: 2014/09/10 21:22 (external edit)