I want to handle an exception for ORA-000942
and am following this manual and this discussion. Since this is an ORA-
error with no predefined name, I want to use exception_init.
When I run this code, I continue to get the ORA-000942
message, but not as expected via the procedure level handler.
create table foobar (foobar_id varchar(1));
declare
procedure p_add_to_foobar
is
p_missing_table exception;
pragma exception_init(p_missing_table, -00942);
begin
insert into foobaz
select '1' from dual;
exception
when p_missing_table then
dbms_output.put_line('MISSING TABLE');
end p_add_to_foobar;
begin
p_add_to_foobar;
dbms_output.put_line('DONE');
end;
Question:
- How do I get my procedure level exception to handle the -942 error?