Thursday, August 30, 2012

Exception example in oracle

set heading off;

set serveroutput on;
spool C:\Users\anandy\Scripts\except.txt;
declare
v_mgr number:=12345;
begin
delete from emp where mgr = 1234;
if SQL%NOTFOUND then
RAISE_APPLICATION_ERROR(-20023,'This is not a valid manager');
end if;
exception
   when no_data_found
   then
dbms_output.put_line('There is no record found');
end;
/
spool off;

No comments:

Post a Comment