Skip to Main Content
  • Questions
  • dependency behaviour of public synonym

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, sohail.

Asked: October 12, 2012 - 4:21 am UTC

Last updated: October 12, 2012 - 9:03 am UTC

Version: 10.2.0

Viewed 1000+ times

You Asked

Hi Tom,

I ran following statements in Oracle 10g Database:

SQL> SELECT version from v$instance

VERSION
-----------------
10.2.0.5.0
1 row selected.

SQL>
create or replace procedure sohail_test
is 
begin
  null;
end;

Procedure created.

SQL>
create or replace public synonym sohail_test for sohail_test
Synonym created.

SQL>
select  * 
from    dba_dependencies
where   name = 'SOHAIL_TEST'

OWNER NAME TYPE REFERENCED_OWNER REFERENCED_NAME REFERENCED_TYPE REFERENCED DEPENDENCY_TYPE
------------------------------ ------------------------------ ----------------- ------------------------------ -------------------- ----------------- ---------- ---------------
PUBLIC SOHAIL_TEST SYNONYM TLMDBO SOHAIL_TEST PROCEDURE HARD
1 row selected.

AND then I run the same statements on a 9i database:

SQL>
SELECT version from v$instance


VERSION
-----------------
9.2.0.8.0
1 row selected.

SQL>
create or replace procedure sohail_test
is 
begin
  null;
end;

Procedure created.

SQL>
create or replace public synonym sohail_test for sohail_test


Synonym created.

SQL>
select  * 
from    dba_dependencies
where   name = 'SOHAIL_TEST'


no rows selected.

I am unable to figure out the reason of why in 10g database the public synonym is being shown in dependencies view. Please could you help?

thanks
sohail

and Tom said...

the question should be "why wasn't it being shown in 9i" shouldn't it...

the way synonyms were handled dependency wise changed between releases. Synonyms did not used to be "dependent" on what they pointed to - you will not find any rows with TYPE=SYNONYM in 9i, you will in 10g and above

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

sohail aslam, October 12, 2012 - 9:40 am UTC

Thanks Tom, Much appreciated.

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library