Synonyms in SQL
Synonyms are the database object which is used to provide
an alternative name to other database objects.
Synonym can be used to specify with objects like:
- Tables
- Views
- Stored
Procedure
- User-Defined
Function
Some points to be remember about synonyms:
- A synonym
cannot refer to another synonym.
- Synonyms
cannot be altered using ALTER statement. To modify the synonym you must
DROP it and recreate.
Create Synonym
To create a synonym, simply specify a synonym name and
name of database object to which it will be assigned.
Syntax:
Create SYNONYM [schemaname.]synonymname
FOR objectname;
Example:
create synonym suppliers for app.suppliers;
Drop Synonym
Syntax:
DROP SYNONYM synonymname;
Example:
Drop synonym suppliers;
No comments:
Post a Comment