CREATE SYNONYM

Creates a new synonym for a table or view.

SYNTAX

synonym_name Name of the new synonym you want to create.
table_name Name of the table you want to create the synonym on.
view_name Name of the view you want to create the synonym on.

DESCRIPTION

The CREATE SYNONYM command creates a new synonym on an existing table or view. You cannot create a synonym on a temporary table or on another synonym. To execute the CREATE SYNONYM command on a table or view, you must be the table or view owner, or have DBA or SYSADM security privileges.

DBMaker normally identifies tables and views with fully qualified names that are a composite of the owner name and object name. To help simplify statements that use fully qualified table and view names, DBMaker provides synonyms.

A synonym is an alternative name (alias) that can be used for a table or view. Since a synonym is simply an alias, it requires no storage space other than its definition in the system catalog. Using synonyms, users can access a table or view through the corresponding synonym without having to use the fully qualified name.

You can create more than one synonym for a table or view, but all synonym names must be unique among all other synonym names in the database. This allows users to refer to synonym names without prefixing an owner name. If you own a table with the same name as a synonym, DBMaker will always use your table and ignore the synonym with the same name. To use the table referenced by the synonym, you must provide the fully qualified name for that table. All synonyms on a table or view are dropped automatically if you drop the referenced table or view.

Synonym names have a maximum length of eighteen characters, and may contain numbers, letters, the underscore character, and the symbols $ and #. The first character may not be a number.

EXAMPLE

The following example creates a synonym named AllEmp for the AllEmployees table owned by User1. You can use the synonym AllEmp in place of the fully qualified table name User1.AllEmployees in subsequent SQL statements.

CREATE SYNONYM AllEmp FOR User1.AllEmployees

The following example creates a synonym named SalesEmp for the SalesEmployees view owned by User2. You can use the synonym SalesEmp in place of the fully qualified view name User1.SalesEmployees in subsequent SQL statements.

CREATE SYNONYM SalesEmp FOR User1.SalesEmployees

RELATED COMMANDS

< CREATE REPLICATION | Contents | CREATE TABLE >

Copyright 2002 SYSCOM Computer Engineering Co. All rights reserved.