Subject | Re: Strange validation error |
---|---|
Author | Adam |
Post date | 2006-05-01T21:30:36Z |
--- In firebird-support@yahoogroups.com, "Eyal" <ez_bikbon@...> wrote:
'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.
Adam
>So you are telling me that if I demand your value can only be either
> 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.
'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.
Adam