Previous |
Next |
To create a synonym, use either the SQL Developer tool Create Database Synonym or the DDL statement CREATE
SYNONYM
.
This tutorial shows how to use the Create Database Synonym tool to create the synonym EMP
for the EMPLOYEES
table. The equivalent DDL statement is:
CREATE SYNONYM EMP FOR EMPLOYEES;
This synonym is part of the sample application that the tutorials and examples in this document show how to develop and deploy.
To create a synonym using the Create Databse Synonym tool:
On the Connections tab, expand hr_conn.
Under the hr_conn
icon, a list of schema object types appears.
Right-click Synonyms.
A list of choices appears.
Click New Synonym.
The Create Database Synonym window opens. The check box Public is deselected, the field Schema has the value HR
, and the field Name has the default value SYNONYM1
.
In the Name field, type EMP
over the default value.
Click the tab Properties.
The Properties pane appears. The Referenced Schema field has the value HR
, the option Object based is deselected, and the option Name based is selected.
Select Object Based.
The option Name based is now deselected.
In the field next to the Object based option, select EMPLOYEES
from the drop-down list.
Object based means that the synonym refers to a specific schema object; in this case, the table EMPLOYEES
.
Click OK.
The synonym EMP
is created. To see it, expand Synonyms in the navigation frame. You can now use EMP
instead of EMPLOYEES
.