Purpose
You can use this statement to drop a synonym.
Syntax
DROP [PUBLIC] SYNONYM [ schema. ]synonym_name [FORCE];
Parameters
| Parameter | Description |
|---|---|
| PUBLIC | You can specify PUBLIC to drop a public synonym. If you do not specify PUBLIC, a private synonym is dropped. |
| schema | The schema where the synonym is located. If schema. is omitted, the synonym in your own schema is dropped. If PUBLIC is specified, schema does not need to be specified for the synonym. |
| synonym_name | The name of the synonym. |
| FORCE | By specifying FORCE, you can drop a synonym even if it has dependent tables or user-defined types. |
Examples
Drop a private synonym.
obclient> DROP SYNONYM user1.syn1; Query OK, 0 rows affectedDrop a public synonym.
obclient> DROP PUBLIC SYNONYM syn2; Query OK, 0 rows affected
Considerations
The following describes the requirements for dropping different types of synonyms:
To drop a private synonym:
Make sure that the synonym to be dropped is in the corresponding schema.
Make sure that you have the
DROP ANY SYNONYMprivilege.
To drop a public synonym:
You must specify the
PUBLICkeyword and must not specifyschema.You must have the
DROP PUBLIC SYNONYMprivilege.