Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Q: Constraints

Q: Constraints

From: Roger Wernersson <roger.wernersson_at_adra.se>
Date: 1996/11/28
Message-ID: <329DB288.78F7@adra.se>#1/1

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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US