insert exception handling
641336Jun 27 2008 — edited Jun 27 2008Hi
I would like to handle just a simple insert exception when table does not exist:
set serveroutput on
declare
insert_excep exception;
pragma exception_init(insert_excep,-01400);
pragma exception_init(no_table, -00942);
begin
insert into hr.departmhents (department_id,department_name) values(280,null);
exception
--when insert_excep then dbms_output.put_line('Insert operation failed');
--when no_table then dbms_output.put_line('No such table');
when others then dbms_output.put_line('Other');
end;
/
insert_excep is working fine when cannot insert values into an existing table
but when I am about to insert into a non-existing table than exception part is not running:
Error at line 2
ORA-06550: line 8, column 20:
PL/SQL: ORA-00942: table or view does not exist
ORA-06550: line 8, column 5:
PL/SQL: SQL Statement ignored
Just a simple dml command.
I studied all infos I could but no solution. I don't really understand.
Attila