Ciaran Gallagher
Ciaran Gallagher

Reputation: 4020

Set the DATA_DEFAULT value for a table column in Oracle SQL Developer

In Oracle SQL Developer, how does one set the default value for a column on a table definition?

(In SQL Developer 3.2)

Upvotes: 2

Views: 18900

Answers (2)

Prasanth Pennepalli
Prasanth Pennepalli

Reputation: 1058

Run the DDL from the SQL editor:

alter table TABLE_NAME modify COLUMN_NAME default VALUE;

Upvotes: 1

Ciaran Gallagher
Ciaran Gallagher

Reputation: 4020

From the 'Connections' tab, right-click on a table in your database, and click 'Edit' from the context menu.

A window like this will appear:

Edit Table window

Select the column that you wish to set a default value, then from the 'Column Properties' panel you can set the default value by populating the 'Default:' field in the form.

After selecting 'OK', the table definition will list the value in the 'DATA_DEFAULT' value in the table definition.

This can also be achieved in the DDL (Data Definition Language) by using the 'DEFAULT' keyword when defining the column, like this:

"ATTACH_FROM" CHAR(1 CHAR) DEFAULT 'S'

Upvotes: 6

Related Questions