Check Constraint and NULL in list of values
Posted on 2006-11-06
Examine the following check constraint...
ORTHDNTC_TRCTN_DVC_IND INDICATOR with default NULL
constraint C_ORTHDNTC_TRCTN_D check (ORTHDNTC_TRCTN_DVC_IND is
null or (ORTHDNTC_TRCTN_DVC_IND in ('N','Y',NULL) and
ORTHDNTC_TRCTN_DVC_IND = upper(ORTHDNTC_TRCTN_DVC_IND))),
The column is based on domain INDICATOR, has permissable values of "Y", "N" and null, and defaults to null. My DBA is telling me that DB2 does not like NULL in the list of values. My modeling tool, PowerDesigner 12.0, is telling me this is OK.
So, can the list of values contain NULL? Of not, how do I tell DB2 that the permissable values are "Y", "N" and null?