SYNONYMS

They are used to give objects different names or aliases. They can be private (used only by one user) or public.

CREATE [PUBLIC] SYNONYM synonym FOR object ;

user1> SELECT * FROM user1.table1@PRODDB;

CREATE PUBLIC SYNONYM t1 FOR user1.table1@PRODDB

Now it can be written as

user1> SELECT * FROM t1;

Private synonyms must be a unique name within their schema. Public synonyms can have the same name as schema objects.

The “public” in “public synonym” means that it is not a schema object and cannot therefore be prefixed with a schema name. It does not mean that everyone has permissions against it.

Droping Synonym
DROP [PUBLIC] SYNONYM synonym ;

Altering Synonym
ALTER SYNONYM synonym COMPILE;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: