CREATE SYNONYM
Use the CREATE SYNONYM statement to create a synonym for a table name or view name.
The name of a synonym is subject to the same restrictions as the name of a table or view. The synonym name must be unique within each schema of a database.
You can create a synonym for a nonexistent table or view. At run time, the system expands the object name to its fully qualified form. If the referenced object does not exist, the system displays an error message.
Syntax
CREATE SYNONYM <synonym> FOR <name>
Inputs
Input | Description |
---|---|
<synonym> | The name of the synonym. |
<name> | The name of the table or view for which the synonym is to be created. |
Output
Output | Description |
---|---|
CREATE SYNONYM | The command was successful. |
Privileges
You must be the admin user, the owner of the database or schema where the synonym is defined, or your account must have the Create Synonym privilege.
Usage
- To create a synonym
pr
for the table payroll:CREATE SYNONYM pr FOR payroll;