Subject Re: Strange validation error
Author Adam
--- In, "Eyal" <ez_bikbon@...> wrote:
> I have the following domain:
> dom_input_code CHAR(1) CHECK (VALUE IN ('C', 'D'))
> I have a table with the input_code column that uses the domain as the
> data type. Neither the domain nor the table DDL forbid NULL in that
> column, ie. NULL should be allowed.

So you are telling me that if I demand your value can only be either
'C' or 'D' that I am meant to accept your NULL? What a strange
concept! You give me an undefined unknown value that could end up
being 'J' at some later date, yet I am still expected to accept it?

Put simply and logically, a NULL would fail your IN condition, because
the statements (NULL = 'C'), and (NULL = 'D') both return null
(unknown or undefined), and when you OR two unknowns together, you get
unknown, which certainly would not return True.

For what you want, try:

dom_input_code CHAR(1) CHECK (VALUE IN ('C', 'D') OR VALUE IS NULL)

Here you are telling the domain that a null in this field is acceptable.