Tuesday, October 14, 2008

Synonym

A Synonym is an alternative name for objects such as tables, views, sequences, stored procedures, and other database objects. Can be either private or public. Public synonym is valid for each schema. Private synonym is valid for the owner alone. Synonyms cannot be used in a drop table, drop view or truncate table/cluster statements.



Syntax:

create [or replace] [public] synonym [schema .] synonym_name

for [schema .] object_name [@dblink];

Used to shorten the specification of long or complex object names.Synonyms are used to Mask the real name and owner of the object.

Provide public access to an object.
Provide location transparency for tables, views or procedures of a remote database.
Simplify the SQL statements for the user.

No comments: