CREATE SYNONYM Statement (create_synonym_statement)
The CREATE SYNONYM
statement (create_synonym_statement
)
defines a synonym (alternative name) for a table name or a sequence name.
Syntax
<create_synonym_statement> ::=
CREATE [PUBLIC] SYNONYM [<schema_name>.]<synonym_name>
FOR <table_name>
| CREATE [PUBLIC] SYNONYM [<schema_name>.]<synonym_name>
FOR <sequence_name>The table name (table_name
) must
not denote a temporary base table. The database user must have one of the
privileges available for the specified table or sequence.
Only the name of the current database user is permitted as the
schema name (schema_name
) in front of the
synonym name.
The synonym name can be specified anywhere instead of the table or sequence name. This has the same effect as specifying the table or sequence name for which the synonym was defined.
If PUBLIC
is specified, the synonym
name must not be identical to the name of a synonym defined in PUBLIC
.
A synonym is generated that can be accessed by all database users.
If PUBLIC
is not specified, a private
synonym is generated that is only known to the current database user. In this
case, the synonym name must not be identical to the name of an existing base
table, view table, seuence or a private synonym of the current database user.
If a synonym with the same name and the PUBLIC
attribute
exists, it cannot be accessed by the current database user until the private
synonym has been dropped.