Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Why the exception object_not_found not work?

846392Mar 29 2011 — edited Mar 30 2011
Posters,

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
This post has been answered by RPuttagunta on Mar 29 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 27 2011
Added on Mar 29 2011
10 comments
1,355 views