![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
When execute the SQL ' Select * from BE_FRIEND' it always returns the data in the table. How to distinguish between a Table and a Synonym? |
#3
| |||
| |||
|
|
basab.da... (AT) gmail (DOT) com wrote: When execute the SQL ' Select * from BE_FRIEND' it always returns the data in the table. How to distinguish between a Table and a Synonym? Not - that is the purpose of a public synonym. If you are referring to the object type (as in "I want to know if be_friend ia a table, or a synonym or both"), then query the all_objects view on object_name and object_type. -- Regards, Frank van Bortel Top-posting is one way to shut me up... |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Thanks Mark & Frank. Actually I was trying to reproduce a client scenario.and wanted to refer to the Synonym (whatever it is refering to) rather than object created with "same name" either in the current schema or any other for which the current owner has privilages. What I get from your replies is the fact that it is NOT right to have Synonym created with a same name that of object which could very well exist in other schema also. From ALL_OBJECTS table, I can get on OBJECT_NAME and OBJECT_TYPE (as suggested by Frank) but exclusivly I cannot call a synonym. The scenario is very simple. SchemaX has a table called TEST and SchemaY also has TEST table. Now a PUBLIC Synonym was created with following syntax CREATE PUBLIC SYNONYM FOR SchemaX.TEST When SchemaY owner wants to call the PUBLIC Synonym TEST so that it can refer to SchemaX.TEST, how will he call it using the Synonym name? SchemaY owner can call TEST table either in his schema or use owner.table_name to refer to any other schema. Is there any way to ensure that I can make a call to PUBLIC Synonym (whatever it refers to) only rather that the object in my current schema having same name. Thank you so much |
#6
| |||
| |||
|
|
basab.da... (AT) gmail (DOT) com wrote: Thanks Mark & Frank. Actually I was trying to reproduce a client scenario.and wanted to refer to the Synonym (whatever it is refering to) rather than object created with "same name" either in the current schema or any other for which the current owner has privilages. What I get from your replies is the fact that it is NOT right to have Synonym created with a same name that of object which could very well exist in other schema also. From ALL_OBJECTS table, I can get on OBJECT_NAME and OBJECT_TYPE (as suggested by Frank) but exclusivly I cannot call a synonym. The scenario is very simple. SchemaX has a table called TEST and SchemaY also has TEST table. Now a PUBLIC Synonym was created with following syntax CREATE PUBLIC SYNONYM FOR SchemaX.TEST When SchemaY owner wants to call the PUBLIC Synonym TEST so that it can refer to SchemaX.TEST, how will he call it using the Synonym name? SchemaY owner can call TEST table either in his schema or use owner.table_name to refer to any other schema. Is there any way to ensure that I can make a call to PUBLIC Synonym (whatever it refers to) only rather that the object in my current schema having same name. Thank you so much You cannot, to my knowledge. One way would be to call the tables prefixed by owner (e.g. schemaY.test vs test). You'll have to test this, as I do not have a test system available (XP forced a reinstall) However, this is one of the reasons to be very careful with public synonyms - better to use private ones. -- Regards, Frank van Bortel Top-posting is one way to shut me up...- Hide quoted text - - Show quoted text - |
![]() |
| Thread Tools | |
| Display Modes | |
| |