eric.itzhak
eric.itzhak

Reputation: 16062

Can I add a unique constraint to a partition?

I failed to find an explicit answer on the topic and didn't pick it up from the documentation.

I want to partition a table by status (A and B), could I add a unique constraint that would apply only to partition A?

Meaning that while a record is with status A it must be unique but if I update it to status B then it would no longer apply to it?

Upvotes: 3

Views: 897

Answers (1)

vishad
vishad

Reputation: 1164

Fistly, if you are planning to update the partitioning Key in a table, hope you have

"Enable Row Movement" enabled

Secondly, don't think it can be done directly using a normal BTree index. You will need to use a Functional Index, Virtual Column as given in : Conditional unique constraint with multiple fields in oracle db

Upvotes: 2

Related Questions