Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Conditional Constraint?
"Howard J. Rogers" <howardjr2000_at_yahoo.com.au> wrote
> As soon as you start doing conditional constraints, you're talking
business
> logic. At which point, your attention invariably should turn the way of a
> before insert and/or before update trigger.
>
> The simple one, that all demerit points should be between 1 and 6 is a
check
> constraint:
>
> create table blah (
> col1 number);
> alter table blah add (constraint blah_col1_ck check (col1 between 1 and
6));
>
> But as soon as you start wanting to say "if this then that', it's trigger
> time.
Check constraints can include AND and OR logic, so a trigger isn't required
here.
Received on Sun Dec 22 2002 - 08:09:10 CST