default constraint updating existing rows
Date: Tue, 16 Dec 2008 13:22:15 -0500
Message-ID: <71F25027B92F3F4EA55005AAC6993B512EB989@PICISWFD-EXCHB.picis.com>
Hi,
We are adding a column with default constraint and we only want it to apply to new rows but it is updating existing rows even though column allows null. I am using the following test:
SQL> create table test (a int);
Table created.
SQL> insert into test values(1);
1 row created.
SQL> insert into test values(2);
1 row created.
SQL> alter table test add b int default 3;
Table altered.
SQL> select * from test;
A B
---------- ----------
1 3 2 3 SQL> desc test Name Null? Type ----------------------------------------- -------- -------------- A NUMBER(38) B NUMBER(38)
Is there any way to add new column with default constraint without updating existing rows?
Thanks
--Harvinder
The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access or use by any other person to this internet email is not authorized and may be unlawful. If you are not the intended recipient, please delete or destroy this email. If you do not wish to receive future emails from this sender, please reply directly to this email requesting you be removed from any mailing list.
--
http://www.freelists.org/webpage/oracle-l
Received on Tue Dec 16 2008 - 12:22:15 CST