Alters a synonym definition.
1 – Environment
You can use the ALTER SYNONYM statement: o In interactive SQL o Embedded in host language programs o As part of a procedure in an SQL module o In dynamic SQL as a statement to be dynamically executed
2 – Format
(B)0[m[1;4mALTER[m [1;4mSYNONYM[m[1m <synonym-name> qwqqqqqqqqqqqqqqqqqqqqqqwqk[m [1mmq> [1;4mFOR[m[1m <object-name> qj[m [1mx[m [1mlqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj[m [1mmwqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqwqqqqqqqqqqqqqqqqqqqqq>[m [1mmq> [1;4mCOMMENT[m[1m IS qwq> 'string' qwqj [m [1mmqqqqq / <qqqqj [m
3 – Arguments
3.1 – COMMENT IS string
This clause can be used to add several lines of comment to the synonym object. The SHOW SYNONYM statement displays the comment. This clause is equivalent to the COMMENT ON SYNONYM statement.
3.2 – FOR object-name
You may change the synonym to reference a different database object; however, it must be of the same type. Oracle Rdb assumes that the object has the same or similar characteristics as the referenced object. The referenced object must exist in the database.
3.3 – synonym-name
The name of an existing synonym you want to alter.
4 – Examples
Example 1: Adding a Comment SQL> ALTER SYNONYM CASH cont> COMMENT IS 'use a different name to avoid confusion with' cont> / 'the domain MONEY'; Example 2: Using Multiple Synonyms and Changing the Referenced Table Using ALTER The following example uses a synonym to reference a table. Later an empty version of the table can be created and the synonym altered to reference this new table. Although similar to using a view definition, the use of synonyms avoid the usage locking of a view. That is, to drop and create a new view requires that no other user references that view, however, the alter synonym does not require exclusive access to the table. SQL> CREATE TABLE t_employees_0001 (...); SQL> CREATE SYNONYM employees FOR t_employees_0001; SQL> CREATE SYNONYM emps FOR employees; SQL> CREATE TABLE t_employees_0002 LIKE t_employees_0001; SQL> ALTER SYNONYM employees FOR t_employees_0002;