Generate DDL for a Package

In this procedure, you can generate DDL for a package, and also compare the DDL with the database.

Access:    Project Browser package context menu | Code Engineering | Generate DDL
                  Select package   Tools | Database Engineering | Generate Package DDL

How To:

To generate DDL for a package, follow the steps below:

Step

Action

See Also

1

Select the menu option

The Generate Package DDL dialog displays

 

2

Select the checkbox against each inclusion required

Deselect the checkboxes for inclusions you do not require

 

3

To recursively generate DDL, select the Include All Child Packages checkbox

 

4

Select the Save Generated Order checkbox to save the order in which the objects are generated

This is useful where the order is changed to resolve object dependencies; the order is saved when you click on the Generate button

 

5

If you click the Refresh button with the Save Generated Order checkbox unchecked, the objects are restored to their original order

 

6

Click on the Generate button to proceed

Enterprise Architect prompts you for file names as the process executes

 

 

To compare the generated DDL with the database, follow the steps below

Step

Action

See Also

1

On the Generate Package DDL dialog, click on the Compare button

The Compare With Database dialog displays

 

2

Click on the (  ...  ) button and locate the required database on the Select Data Source dialog

 

3

For an Oracle database, if required you can also specify the Owner in the Schema/Owner field

 

4

Click on the View button to perform the comparison

The Comparison Database dialog displays with the results of the comparison

Click on each table name to review information on that table

 

Notes:

  • In the Corporate, Business and Software Engineering, System Engineering and Ultimate editions of Enterprise Architect, if security is enabled you must have Generate Source Code and DDL permission to generate DDL
  • Some checkboxes display only if the appropriate database is defined for the table. For example, IF EXISTS displays only if the database for the table is PostgreSQL, and SEQ_ and _SEQ radio buttons display only if the database for the table is Oracle
  • For a PostgreSQL database, you must select the Generate Sequences checkbox to enable auto increment columns to be created
  • If generating Oracle sequences, you must always select the Generate Triggers and Generate Sequences checkboxes - this ensures that a pre-insert trigger is generated to select the next sequence value to populate the column; also set the AutoNum property to True in the column properties
  • If generating Oracle sequences, to generate the sequence name and trigger name with  the syntax SEQ_<sequence_name>  and TRG_<trigger_name>, select the SEQ_ option; conversely, to generate them with the syntax <sequence_name>_SEQ and SET_<trigger_name>, select the _SEQ option

Learn More: