Oracle Database Packages

Packages, as well as Types can be created in Luna Modeler as other objects and displayed as simple graphical representatives with custom colors. One single object contains basic properties as well as:

  • PACKAGE SPECIFICATION and
  • PACKAGE BODY

Creating Oracle Database Packages

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

Adding a new Oracle database package to ERD in Luna Modeler. The picture shows a toolbar with the Package item.

Then click the diagram area to place a new graphical representative to the desired position.

In the right-side panel, on tab Details you can specify the Name and the Description for the Package. If you enable displaying descriptions in the diagram settings, the description will be displayed below the package graphics in your ERD.

Newly added Oracle Database package with custom description.

Click the Script tab and define the code for PACKAGE SPECIFICATION and PACKAGE BODY. If you need a larger area for the code definition, double click the graphical object on the diagram to open a modal form.

A larger modal form with sections for package specification and package body definitions.

Other Objects as Complementary Items

In Luna Modeler, you can also add Other objects to diagrams and include scripts that describe how to how to retrieve records, etc. This feature adds additional value to your diagrams and can help you better document how you work with Packages. See the following example:

Oracle Database Package and Other objects with code samples.

To add a new Other object, click the Other item on the main toolbar or add a new object using the diagram context menu.

Adding new Other object to ERD created in Luna Modeler database design tool.

Then specify the name (1) and colors (2) for the other object.

Other object properties.

On the Script tab, define Custom code. If you do not want the code to be included in the generated scripts for the entire project, turn off the switch.

Custom code defined for the other object.

This way you can create several other objects. If you want to group them, use Object Areas. These can help you get a better visual representation of the other objects and also make it easier to manipulate objects belonging to a subject area.

A subject area with three other objects that contain sample code for working with the defined Oracle Database Packages.

Package SPECS and Package BODIES in Luna Modeler

Packages – with package specification and package body – are displayed as single objects on the diagram and in the left side panel with the overview of all objects. See item PRODUCT_PKG.

Side panel with overview of Oracle Database objects and ERD.

However, for the generated SQL script, it may be important to change the order of package specification and package body. Therefore, package specifications and package bodies are handled separately in Luna Modeler, and you can manually change the order. See the PRODUCT_PKG item on the following screenshot. It is displayed twice, once as a Package (specification) and once as a Package body.

Order of generated objects in a project created for Oracle Database. On the screenshot, package specification and package body are listed separately.

#

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