ALTER SYNONYM
Use the ALTER SYNONYM command to rename or change the owner of a synonym.
Syntax
Syntax for altering
a synonym:
ALTER SYNONYM <synonym> [ RENAME TO <new_name> ]
[ OWNER TO <new_owner> ]Inputs
The ALTER SYNONYM command takes the following inputs:
| Input | Description |
|---|---|
| RENAME TO <new_name> | The new name of the synonym. |
| OWNER TO <new_owner> | The name of the new owner. |
| <synonym> | The name of the synonym. |
Output
The ALTER SYNONYM command produces the following output:
| Output | Description |
|---|---|
| ALTER SYNONYM | The command was successful. |
Privileges
You must be the admin user, the synonym owner, the owner of the database or schema where the synonym is defined, or your account must have the Alter privilege for this synonym or the Synonym object class. If you are changing the owner of the synonym, you must have List access to the user account.
Usage
The following provides
sample usage:
- Rename the synonym payroll to
pr:MYDB.SCH1(USER)=> ALTER SYNONYM payroll RENAME TO pr; - Change the owner of the synonym
pr:MYDB.SCH1(USER)=> ALTER SYNONYM pr OWNER TO accounting;