Neoview SQL Reference Manual (R2.3)

ALTER SYNONYM Statement
“Syntax Description of ALTER SYNONYM ”
“Considerations”
“Example of ALTER SYNONYM”
The ALTER SYNONYM statement allows you to change the table, view, or materialized view
the synonym is referencing to a different object of the same structure. You can write queries that
reference the synonym and use the ALTER SYNONYM command to point to a different object
with the same structure. The advantage of this is to change the object being referenced without
changing the query.
When a synonym is assigned to an object, the object can be referenced either with the synonym
name or the actual name. The resultant query results will be the same.
Syntax Description of ALTER SYNONYM
ALTER SYNONYM alternate-name TO object;
alternate-name
specifies the name of the synonym. See “Database Object Names” (page 206).
object
specifies Neoview SQL tables, views, and materialized views. See “Database Object Names”
(page 206).
Considerations
When the object being referenced by the synonym is dropped, then the synonym is also
dropped.
Only the owner of the table, view or materialized view, the schema owner, anyone having
the ALTER privileges, or the services ID can create, alter, or drop the alternate names for a
table.
You can create an unlimited number of synonyms for a single object.
Grant and Revoke commands are allowed on synonyms. The command will be applied to
the actual reference object.
View, constraints, and trigger text cannot use synonym names in their DML text.
Synonyms cannot be renamed. The RENAME operation is allowed on actual table names
only.
Example of ALTER SYNONYM
This example changes a synonym:
ALTER SYNONYM aname TO s-table
46 SQL Statements