I currently have this constraint added to table MY_TABLE
ALTER TABLE MY_TABLE ADD CONSTRAINT MY_TABLE_UNQ_01 UNIQUE (COLUMN1, COLUMN2, COLUMN3) USING INDEX TABLESPACE "MY_TABLE_INDEX";
The problem is that I have added a new column:
ALTER TABLE MY_TABLE ADD (DRAFT NUMBER(1,0));
Now the constraint should apply only when the column DRAFT = 0
Is there some way how to do this?
In 11g, you could define a constraint on virtual columns:
In 10g and before, you can use a function based unique index and the fact that all-NULL index entries are not recorded. So the following index will guarantee the unicity only when
draft=0: