Oracle synonym, oraclesynonym
Synonym:
For another data object, the synonym is an alias that depends on the target object. If the target object is changed or deleted, the synonym becomes invalid.
Synonyms cannot replace the privileges of database objects, that is, they first have the query, execution, deletion, and other permissions on the objects in the mode.
Permission:
To CREATE a private SYNONYM in your own mode, you must have the create synonym system privilege.
To CREATE a private SYNONYM in another user's mode, you must have the create any synonym system privilege.
To CREATE a public synonym, you must have the create public synonym system privilege.
Table Synonyms
Create synonym offices FOR hr. locations;
Synonyms of Stored Procedures
Create or replace synonym SP_INSERTXY for ys_adm.SP_INSERTXY;
Grant execute on SP_INSERTXY to ys_app
Example:
If your oa has an offices table object and you have the permission to query the hr offices table, select * from offices queries your own data. To check the hr mode, select * from hr. offices
If the user oa does not have an offices table object and has the permission to query the hr offices table, create a synonymCreate synonym offices FOR hr. offices;Execute select * from offices; the system returns hr user data.