Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Q: Constraints
Hello folks!
I have a policy problem. Some of the columns in my tables are only allowed to have either the value 'Y' or the value 'N'. Null values are not allowed.
Should I have one constraint checking the value of the column and one NOT NULL constraint or should I have one and only one constraint checking both of these cases?
ALTER TABLE a ADD CONSTRAINT b CHECK (NVL (c, '-') IN ('Y', 'N'));
or
ALTER TABLE a MODIFY b NOT NULL;
ALTER TABLE a ADD CONSTRAINT b CHECK (c IN ('Y', 'N'));
???
-- Sport radio: people listening to people watching people having fun Mailto:roger.wernersson_at_adra.se BTW: All opinions are mine, all mine, and nobody's but mine.Received on Thu Nov 28 1996 - 00:00:00 CST