Neoview SQL Reference Manual (R2.4 SP2)
ALTER SYNONYM Statement
• “Syntax Description of ALTER SYNONYM”
• “Considerations for ALTER SYNONYM”
• “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.
ALTER SYNONYM alternate-name TO object
Syntax Description of ALTER SYNONYM
alternate-name
specifies the name of the synonym. See “Database Object Names” (page 230).
object
specifies the name of a Neoview SQL table, view, or materialized view. See “Database Object
Names” (page 230).
Considerations for ALTER SYNONYM
• Only the owner of the object, the schema owner, or anyone having the ALTER privileges
can alter the synonym for an object.
• When a synonym is changed, all queries using the synonym are recompiled to use the new
table. In flight queries are aborted.
• When a synonym for an object is changed, any currently executing plans fail and requires
name resolution and similarity check. If the similarity check fails, existing plans referencing
the new object associated with the synonym name require compilation or recompilation.
Example of ALTER SYNONYM
• This example changes a synonym:
ALTER SYNONYM aname TO s-table
ALTER SYNONYM Statement 43