All Products
Search
Document Center

DROP SYNONYM

Last Updated: Jun 18, 2021

Description

This statement deletes a synonym.

Syntax

DROP [PUBLIC] SYNONYM [ schema. ]synonym;

Parameter description

Parameter

Description

PUBLIC

Specify PUBLIC to delete a public synonym. If you do not specify PUBLIC, a private synonym is deleted.

[ schema. ]synonym

The schema field specifies the schema to which the current synonym belongs. If PUBLIC is specified, you do not need to specify the schema field for the synonym. The synonym field specifies the name of the synonym.

Examples

  • Delete a synonym.

OceanBase(TEST@TEST)>drop synonym test.s1;
Query OK, 0 rows affected (0.04 sec)
  • Delete a public synonym.

OceanBase(TEST@TEST)>drop public synonym syn_pub;
Query OK, 0 rows affected (0.03 sec)

Considerations

  1. When you delete a synonym, you must have the following permissions:

    • If you need to delete a private synonym:

      • The synonym to be deleted must be under the corresponding schema.

      • You must have the DROP ANY SYNONYM permission.

    • When you delete a public synonym, you must have the DROP PUBLIC SYNONYM permission.

  1. When you delete a public synonym, you must specify the PUBLIC keyword and do not specify the schema.