background image
<< Special Considerations for Exporting Sequences | Generating a Script for Creating Objects >>
<< Special Considerations for Exporting Sequences | Generating a Script for Creating Objects >>

Generating a Script for Creating Tables

Exporting the Database Objects
Deploying a Database Application 7-7
If triggers populate any auditing columns (such as
CREATED_ON
or
CREATED_BY
),
you must preserve the data from your source table by having the trigger set a new
value only if the current value is null, as in the following example:
if :new.created_on is null
then :new.created_on := sysdate;
end if;
The tables that you created using the instructions in this guide did not use any
triggers, so you will not need to edit the code generated if you follow the instructions
in the related topics for generating scripts.
Generating a Script for Creating the Sequence and Tables
Generate a script to create the sequence and tables that you created if you followed the
instructions earlier in this guide. This script will also create any necessary constraints,
indexes, and triggers.
To generate a script for creating the sequence and tables:
1.
Create a directory in which to export the DDL statements and table data.
Create this directory separate from the Oracle installation directory, for example,
C:\my_exports
.
2.
From the SQL Developer main menu, select Tools, then Export DDL (and Data).
3.
In the Export dialog box, specify the name and location of the to be created that
will contain the SQL statements to create the objects and insert data. For example:
C:\my_exports\2day_tables.sql
4.
Under Options, specify the following options for creating the tables for this
example: