Subject Checking constraints with boolean flag
Author Laurent Duperval
Hi,

We use a "is_deleted" to show wheter a row is active or deleted. We have
a rule that says that no two rows in our table can contain the same
value for column "name" if the value for column "is_deleted" is set to
false.

For example, this is valid data:

ID | Name | IS_DELETED
---------------------------------
ID1| Name 1 | 'F'
ID2| Name 1 | 'T'
ID3| Name 1 | 'T'

While this is not:

ID | Name | IS_DELETED
---------------------------------
ID1| Name 1 | 'F'
ID2| Name 1 | 'F'
ID3| Name 1 | 'T'


Is there a clean way for me to enforce this at the database level or
should I take care of it at the application level?

Thanks,

L