Why the exception object_not_found not work?
846392Mar 29 2011 — edited Mar 30 2011Posters,
I have the following statement in a package.procedure:
-- (...)
begin
select dbms_metadata.get_dependent_ddl('INDEX', sTableName, 'OWNER')
into cDDL -- clob for DDL de index(es)
from dual
-- (...)
exception
when dbms_metadata.object_not_found then
null;
end;
-- (...)
The execution is stopped in the select, not enter in the exception and the following message is displayed in PL/SQL Developer MicroHelp:
+"ORA-31608: specified object of type INDEX not found"+
So I did it another way by adding the following clause:
-- (...)
begin
select dbms_metadata.get_dependent_ddl('INDEX', sTableName, 'OWNER')
into cDDL -- clob for DDL de index(es)
from dual
where exists (select 1+
from all_indexes+
where table_owner = 'OWNER'+
and table_name = sTableName);+
-- (...)
exception
+when no_data_found then+
null;
end;
-- (...)
It works, but: Why the exception object_not_found not work?
Thanks in advance for everyone!
Philips