Search code examples
oracle-sqldeveloper

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)


Solution

  • 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'