Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Check constraint violated
Originally posted by Me
> On Sat, 14 Jun 2003 11:33:48 +0000, andrewst wrote:
>
> >Originally posted by Me
> >> On Fri, 13 Jun 2003 21:33:43 +0530, Me wrote:
> >> >2) How can I put a check constraint that allows entering
> data
> >> into apointee only
> >> >if the nominee's age is lesser than 18?
> >> Could someone help me with this constraint.
> >ALTER TABLE apointee
> >ADD CONSTRAINT chk_nominee_age CHECK (age < 18);
>
> No, that would not work. What I mean is this:
> There are two separate relations by name nominee and apointee; a
> policy holder
> will always have a nominee, if the nominee is a minor only then he
> will have an
> apointee whose age _will_ have to be greater than 18.
>
> At the same time the proposer's nominee's age must be lesser than
> 18 (minor)
>
> Thanks.
In that case, you cannot use a check constraint. A check constraint can
only compare values from ONE row of ONE table. You will have to write a
trigger, or encapsulate the rule in an API procedure.
-- Posted via http://dbforums.comReceived on Sat Jun 14 2003 - 08:46:44 CDT
![]() |
![]() |