Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: SQL Question: CHECK constraint or trigger?
John Wiberg wrote:
> Try changing the check constraint to (CURRENT='Y'). That will allow
> values of 'Y' or NULL, NULL replacing 'N' in your application logic.
> Then add a unique key constraint on (NAMEID, CURRENT). This combination
> of constraints will allow one instance of NAMEID + 'Y' and multiple
> instances of NAMEID + NULL.
The last sentence is wrong. This method will not allow multiple instances of NAMEID + NULL, because this is the one and only exceptional case where NULL is equal to NULL. This is done by Oracle to enforce unique constraints.
Anne-Marie Ternes
anne-marie.ternes_at_cie.etat.lu Received on Thu Mar 05 1998 - 00:00:00 CST