After you have designed your database you need to get the DDLs to be able to create the database objects. When generating the DDL scripts with Data Modeler you have two choices: generate just a single file or several files. Depending on your processes and your current need one of these could be much better option than the other.

To generate the DDLs select Export, DDL File from the File Menu:

Export1

 

Then select the RDBMS you want to generate the DDL for (Oracle, SQL Server or DB2 and the right version of it, in Data Modeler that is called a Database Site) and the relational model wanted. Press Generate.

Export2

Now select the objects you want to generate the DDLs for.

Export3

And with the selection in Generate DDL in Separate Files you define whether the DDL will be a single file (not selected) or generated in separate files (selected).

If you select Generate DDL in Separate Files and press OK, you are asked for the directory where the DDL files will be saved:

Export4

Select that and in that directory you will have several new subdirectories:

Export45

Each of these subdirectories will include files for creating an object of that type. For instance the Table subdirectory might look something like this:

Export5

Whether you chose Generate DDL in Separate Files or not, you will have one single DDL file shown in the tool:

Export6

and you can save that as a single file by pressing Save.

In short: if you do not select Generate DDL in Separate Files you will have the DDL in one file and you can either save it or not. If you select Generate DDL in Separate Files you will automatically have the several DDL files saved in the directory you have specified and you can save the single DDL file if you want.

Note: if the physical model is not open the DDLs will be very general without any physical properties. If the physical model is closed the DDL might look like this:

CREATE TABLE Customer
(
CustNO NUMBER (10) NOT NULL ,
Name   VARCHAR2 (100) NOT NULL
) ;
ALTER TABLE Customer ADD CONSTRAINT Customer_PK PRIMARY KEY ( CustNO ) ;

And if it is open it might look something like this:

CREATE TABLE Customer
(
CustNO NUMBER (10) NOT NULL ,
Name   VARCHAR2 (100) NOT NULL
)
PCTFREE 10 PCTUSED 40 TABLESPACE TableSpace1 LOGGING STORAGE
  (
    PCTINCREASE 0 MINEXTENTS 1 MAXEXTENTS UNLIMITED FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT
  ) ;
ALTER TABLE Customer ADD CONSTRAINT Customer_PK PRIMARY KEY ( CustNO ) ;

 

Advertisements