Was this helpful?
CREATE SYNONYM
Valid in: SQL, ESQL, DBProc, OpenAPI, ODBC, JDBC, .NET
The CREATE SYNONYM statement defines a synonym for a table, view, or index. A synonym is an alias (alternate name) for an object.
This statement has the following format:
CREATE SYNONYM synonym_name FOR [schema.]object
synonym_name
Specifies a valid object name and must not conflict with the names of other tables, views, indexes, or synonyms owned by the user issuing the statement. Synonyms can be used in any place where the table, view, or index identifiers are required.
References to synonyms in applications are resolved to their base objects at runtime. References to synonyms in definitions of database procedures, views, and permissions are resolved at the time the procedure, view, or permission is defined. For this reason, the synonym must be valid at definition time and at runtime, but can be dropped and recreated in between.
Use the HELP statement to display existing synonyms.
To display all the synonyms that you own
HELP SYNONYM *
To display all the synonyms that you own and have access to
HELP SYNONYM *.*
Embedded Usage
You cannot use host language variables in an embedded CREATE SYNONYM statement.
Permissions
This statement is available to all users.
Locking
The CREATE SYNONYM statement locks the iisynonym system catalog, and takes an exclusive lock on the table, view, or index for which a synonym is being created.
Related Statements
Last modified date: 12/19/2024