Valid in: SQL, ESQL
The Drop Synonym statement deletes one or more synonyms from a database. A synonym is an alias (alternate name) for a table, view, or index; synonyms are created using the Create Synonym
Dropping a synonym causes the DBMS Server to re-compile any repeat query or database procedure that references the alias. Dropping a synonym has no effect on views or permissions defined using the synonym.
When a table, view, or index is dropped (using the drop statement), all synonyms that have been defined for it are dropped.
The Drop Synonym statement has the following format:
[EXEC SQL] DROP SYNONYM [schema.]synonym_name {, [schema.]synonym_name};
You cannot use host language variables in an embedded Drop Synonym statement.
To drop a synonym that resides in a schema owned by the session's effective user, omit the schema parameter. To drop a synonym that resides in a schema owned by the session's effective group or role, specify the schema parameter.
The Drop Synonym statement takes an exclusive lock on the object for which the synonym was defined.
The following example deletes a synonym for the authors table:
drop synonym writers;