现在有这样一个需求,针对于表的部分数据增加唯一性约束,数据为逻辑删除,但是唯一性约束想加在没有被删除的数据上类似于
alter table xxx add constraint xxx unique (字段1,字段2,字段3) where is_del = 0
这样的逻辑请问sql应该怎么写 急~~~!!!谢谢大家~~!!!
alter table xxx add constraint xxx unique (字段1,字段2,字段3) where is_del = 0
这样的逻辑请问sql应该怎么写 急~~~!!!谢谢大家~~!!!
create unique index uq_name_idx on xxx (nvl2(nullif(is_del,1),字段1,null,nvl2(nullif(is_del,1),字段2,null,nvl2(nullif(is_del,1),字段3,null));