Oracle Synonyms

Synonyms in Oracle Database projects can be created in Luna Modeler as other objects and displayed as simple graphical representatives with custom colors. Synonyms can be created for

  • objects that exist in the project
  • external objects

In certain scenarios, the synonyms can be used as reusable items and assigned to table columns as data types.

Creating Basic Oracle Database Synonyms

To add a new synonym, click Other on the main toolbar and select Synonym from the drop-down.

Toolbar in Luna Modeler showing how to add a new synonym to Oracle Database design

Then click the diagram area to place a new graphical representative to the desired position.
You can also add new object via context menu:

ER Diagram context menu with the option to add a new oracle synonym to the project and the diagram.

In the right-side panel, you can specify the Name (1) for the Synonym and choose the target object from the For drop down (2).

Selecting object for a new oracle synonym.

Creating Synonyms for Types

Types can be defined in projects for Oracle Database. Types can be used as data types for table columns, and synonyms can be created for the defined types.

On the screenshot below you can see type PRODUCT_TYPE. Let’s create a new synonym ARTICLE for PRODUCT_TYPE. Add a new synonym, specify name and choose the PRODUCT_TYPE from the drop down.

Oracle synonym for Type object.

Now both the PRODUCT_TYPE as well as the ARTICLE synonym can be assigned to a table column the same same way as standard data types.

See how to change the datatype for column PRODUCTS in table CART.

Selection of the newly created Oracle Synonym for Type and assignment of the synonym to a table column.

Creating Synonyms for External Objects

In Luna Modeler you can also create synonyms for external objects, for example for objects from other schema etc.

To create a synonym for an external object, select item External object (not in the project) item from the For drop-down. Then specify Object type, Object schema and Object name values.

Oracle synonym for an external object.

In case the external object Type, the item can be assigned to table columns. In the example below, you can see a newly created synonym SKU_TYPE and how to assign the synonym to the SKU column in table PRODUCT.

Selection of a synonym for table column in a project for Oracle Database.

As you can see, this way you can create synonyms for external tables, views, functions… and also external types that can be assigned to table columns as data types.

Final database design for Oracle Database:

ER Diagram made for Oracle Database. Synonyms displayed in the ERD.

Generated SQL Script and Custom Code

To view the generated SQL script, either navigate to the Script tab in the right side panel or double click the synonym and click the Script tab.

In section Script preview you can see the generated SQL (1). You can also specify custom code (2) for the synonym and include it in the generated code for your project.

Generated synonym code for the Oracle project in Luna Modeler data modeling tool.

#

DATA MODELING TOOLS
DRAW Diagrams and
GENERATE Scripts
Download data modeling tools
Blog Categories
Blog by Platforms