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

Home -> Community -> Usenet -> c.d.o.server -> Re: check constraint question

Re: check constraint question

From: Frank <franjoe_at_frisurf.no>
Date: Wed, 9 May 2001 23:18:49 +0200
Message-ID: <rviK6.5978$Ty6.138368@news1.oke.nextra.no>

Hi!
I have always problem to remember this :-) but could it be that the problem is that the NULL values in your column are the problem? I don't remember how Oracle will react to:
check ((NULL != '0101') and (NULL != 'OTH'));

You could try to update your column to one of the allowed values, or use NVL. Frank

Dina Newsham <d_newsham_at_hotmail.com> wrote in message news:9dbslq$am6$1_at_usenet.nau.edu...
> Hi,
>
> I am still learning so I apologize in advance if this is an easy question.
> I am trying to put a check constraint on a table, with 2 checks, like so:
>
> alter table actual
> add constraint act_oth_tuition check ((acct != '0101') and (dept !=
 'OTH'));
>
> so that if somebody tries to enter values into the table in dept OTH, acct
> 0101, they are not allowed. I am getting the following error:
>
> add constraint act_oth_tuition check ((acct != '0101') and (dept !=
 'OTH'))
> *
> ERROR at line 2:
> ORA-02293: cannot validate (DAN5.ACT_OTH_TUITION) - check constraint
> violated
>
> There is no data in these rows, which the error code refers to (as far as
 I
> can tell), and the constraint does not already exist. Can somebody tell
 me
> if this type of constraint is allowed... I am running it on 3 tables. One
> table accepts the constraint and the other 2 give the error.
>
> Thanks
> Dina
>
>
Received on Wed May 09 2001 - 16:18:49 CDT

Original text of this message

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