All Products
Search
Document Center

DROP SYNONYM

Last Updated: Jun 18, 2021

Description

You can execute the DROP SYNONYM statement to delete a synonym.

Syntax

DROP [PUBLIC] SYNONYM [ DATABASE. ]synonym;

Parameters

  • PUBLIC

    Delete a public synonym. If you do not use PUBLIC, a private synonym is deleted.

  • [ DATABASE. ]synonym

    The database to which the current synonym belongs. If you add PUBLIC to the statement, you do not need to specify the database for the synonym. synonym specifies the name of the synonym.

Examples

  • Delete a synonym.
OceanBase(admin@test)>drop synonym test.s1;
Query OK, 0 rows affected (0.03 sec)
  • Delete a public synonym.
OceanBase(admin@test)>drop public synonym syn_pub;
Query OK, 0 rows affected (0.02 sec)

Notes

Notice

  • To delete a private synonym, ensure that the synonym belongs to the specified database and you have the DROP ANY SYNONYM permission.

  • To delete a public synonym, ensure that you have the DROP PUBLIC SYNONYM permission.

  • To delete a public synonym, make sure that you add PUBLIC to the statement and do not specify the database.