Help Center > > Developer Guide> SQL Reference> SQL Syntax> ALTER SYNONYM

ALTER SYNONYM

Updated at: Jul 15, 2020 GMT+08:00

Function

ALTER SYNONYM is used to modify the attribute of a synonym.

Precautions

  • Only the synonym owner can be changed.
  • Only the system administrator has the permission to modify the synonym owner information.
  • The new owner must have the CREATE permission on the schema where the synonym resides.

Syntax

1
2
ALTER SYNONYM synonym_name
    OWNER TO new_owner;

Parameter Description

  • synonym

    Name of a synonym to be modified (optionally with schema names)

    Value range: A string compliant with the identifier naming rules

  • new_owner

    New owner of a synonym object

    Value range: A string. It must be a valid username.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
-- Create synonym t1.
CREATE OR REPLACE SYNONYM t1 FOR ot.t1;

-- Create user u1.
CREATE USER u1 PASSWORD 'user@111';

-- Change the owner of the synonym t1 to u1.
ALTER SYNONYM t1 OWNER TO u1;

-- Delete synonym t1.
DROP SYNONYM t1;

-- Delete user u1.
DROP USER u1;

Helpful Links

CREATE SYNONYM and DROP SYNONYM

Did you find this page helpful?

Submit successfully!

Thank you for your feedback. Your feedback helps make our documentation better.

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel