SYNONYM
SYNONYM is an alternate name for an object. It is a schema object.
Syntax
CREATE synonym E1 fro Employees;
SELECT * FROM Employees;
SELECT * FROM E1;
Rules:
When you call the synonym name it is called the table name itself.
The insertion operation performed in the synonym means the data inserted in the table.
There are multiple number of synonym created in the single table.
The synonym name alteration is possible by using another synonyms name.
CREATE synonym E2 for E1;
Now E2 will call the E1
E1 will call the table Employees;
DROP SYNONYM E2;-- This is the command for drop synonym
RENAME E1 to E5;-- You can change the synonym name it means rename the old synonym name.
When table is dropped means synonym does not dropped.
After drop the table the synonym is call means Error ORA-00980 Synonym translation is no longer valid.
When you drop the synonym name means synonym only dropped table does not dropped.
Without table synonym is created but its synonym call means error occur.
Two Types
Private Synonym : You cant access the synonym for any schema.
Public Synonym : You can access the synonym for any schema.
A normal synonym is called private synonym whereas a public synonym is created by a keyword public.
A private synonym is accessible within your schema and a public synonym is accessible to any schema in the database.
CREATE SYNONYM system privilege is required to create a private synonym and CREATE PUBLIC SYNONYM system privilege is required to create a public synonym
SYNONYM is an alternate name for an object. It is a schema object.
Syntax
CREATE synonym E1 fro Employees;
SELECT * FROM Employees;
SELECT * FROM E1;
Rules:
When you call the synonym name it is called the table name itself.
The insertion operation performed in the synonym means the data inserted in the table.
There are multiple number of synonym created in the single table.
The synonym name alteration is possible by using another synonyms name.
CREATE synonym E2 for E1;
Now E2 will call the E1
E1 will call the table Employees;
DROP SYNONYM E2;-- This is the command for drop synonym
RENAME E1 to E5;-- You can change the synonym name it means rename the old synonym name.
When table is dropped means synonym does not dropped.
After drop the table the synonym is call means Error ORA-00980 Synonym translation is no longer valid.
When you drop the synonym name means synonym only dropped table does not dropped.
Without table synonym is created but its synonym call means error occur.
Two Types
Private Synonym : You cant access the synonym for any schema.
Public Synonym : You can access the synonym for any schema.
A normal synonym is called private synonym whereas a public synonym is created by a keyword public.
A private synonym is accessible within your schema and a public synonym is accessible to any schema in the database.
CREATE SYNONYM system privilege is required to create a private synonym and CREATE PUBLIC SYNONYM system privilege is required to create a public synonym