Oracle limitation

Is it possible to add a validation constraint that ensures that all values ​​are unique, but allow duplicate default values?

+7
source share
1 answer

You can achieve this using a funcction-based index (FBI):

create unique index idx on my_table (case when col != 'DEFAULT' then col end)); 

This creates a unique index for all values ​​except "DEFAULT".

+11
source

All Articles