How to create a Public Synonym?
The syntax for creating a public synonym is
CREATE [ OR REPLACE ] PUBLIC SYNONYM synonym_name FOR object;
Example:
CREATE PUBLIC SYNONYM clerk FOR employee;
In our context employee is a table (or can be a view). As Clerk is also an employee, it makes understanding more easy.
You can query from clerk as you would do from employee table/view. Now you must have got the idea of why a synonym is used.
Note: The usage of a public synonym from private synonym will be where you need to expose your not-so critical data to all database users. If your data is considered private, you should not be creating public synonyms for this purpose.
How to destroy a Public Synonym?
To destroy or drop a public synonym follow the syntax:
DROP PUBLIC SYNONYM synonym_name;
Example:
DROP PUBLIC SYNONYM clerk;
Click here to learn What is (Private) Synonym?
No comments :
Post a Comment