Synonym types in oracle


SYNONYM: In English language usually we heard about synonym which means the other name of a word, similarly synonym  in oracle made the possibility to shorten the object names which are very much complex. Synonym is specially useful for shared tables and views. To create a synonym means to create an alternative name for an object/objects ( table, object table, view, object view, stored procedure, stored function, materialized view, sequence, package and other objects).

Syntax: CREATE SYNONYM synonym_name FOR reference;
Example:
CREATE PUBLIC SYNONYM Customer
                 FOR
app.Customer;

The synonym cannot be created while dropping a table, dropping a view or truncate table. Synonyms are divided in to two parts and these are:

1) Public

Public synonym are valid for each schema and can be accessible to all users of a database. It is owned by the special user group "PUBLIC". Also, the user with appropriate privileges (usually DBAs) can create public synonym.

2) Private

Unlike public synonym private synonym is used by the user who created it having its unique name in its schema. We can also say it is contained in the schema of a specific user and only be available to the user who have the appropriate privilege on the underlying database objects.
Ebook Download
View all
Learn
View all
F11Research & Development, LLC