Default Value on a column [message #72668] |
Tue, 26 August 2003 05:38 |
Roy George
Messages: 7 Registered: March 2001
|
Junior Member |
|
|
Hello,
I have a table with one column having default value as '0000'. Now, we don't want this default any more. Is there a way, to remove this deafult value on this column? Help pls....
Rgds,
Roy
|
|
|
Re: Default Value on a column [message #72671 is a reply to message #72668] |
Tue, 26 August 2003 16:15 |
|
Barbara Boehmer
Messages: 9102 Registered: November 2002 Location: California, USA
|
Senior Member |
|
|
You can change the default to null, as in the following example:
SQL> CREATE TABLE a_table
2 (one_column VARCHAR2 (4) DEFAULT '0000',
3 another_column NUMBER)
4 /
Table created.
SQL> INSERT INTO a_table VALUES ('1111', 1)
2 /
1 row created.
SQL> INSERT INTO a_table (another_column) VALUES (2)
2 /
1 row created.
SQL> SELECT * FROM a_table
2 /
ONE_ ANOTHER_COLUMN
---- --------------
1111 1
0000 2
SQL> <b>ALTER TABLE a_table MODIFY one_column VARCHAR2 (4) DEFAULT NULL
2 /</b>
Table altered.
SQL> INSERT INTO a_table (another_column) VALUES (3)
2 /
1 row created.
SQL> SELECT * FROM a_table
2 /
ONE_ ANOTHER_COLUMN
---- --------------
1111 1
0000 2
3
|
|
|