User Tools

Site Tools


kurs:exception_raise_und_raise_application_error

Differences

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

Link to this comparison view

kurs:exception_raise_und_raise_application_error [2014/09/10 21:22]
kurs:exception_raise_und_raise_application_error [2014/09/10 21:22] (current)
Line 1: Line 1:
 +<​code>​
 +declare
 +  e_emp_remaining exception;
 +  ​
 +  e_no_department exception;
 +  ​
 +  pragma exception_init
 +    (e_emp_remaining,​ -2292);
 +    ​
 +  pragma exception_init
 +    (e_no_department,​ -20001);
 +  ​
 +begin
 +  delete from departments where department_id = 2701;
 +  if SQL%notfound then 
 +    raise_application_error(-20001,​ 'kein department'​);​
 +  --  raise e_no_department;​
 +  end if;
 +  rollback;
  
 +exception ​
 +  when e_no_department then
 +  dbms_output.put_line('​kein department >'
 +    || SQLCODE ||'<​ '
 +    || SQLERRM );  ​
 +  when e_emp_remaining then
 +  dbms_output.put_line('​noch employees da! >'
 +    || SQLCODE ||'<​ '
 +    || SQLERRM );
 +
 +end;
 +</​code>​
kurs/exception_raise_und_raise_application_error.txt ยท Last modified: 2014/09/10 21:22 (external edit)