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: David Busby <dbusby3_at_slb.com>
Date: Wed, 09 May 2001 12:22:43 -0500
Message-ID: <3AF97CE3.3AC1B400@slb.com>

Change all the != to <>. The NOT EQUAL syntax is <>

Dina Newsham wrote:

> 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 - 12:22:43 CDT

Original text of this message

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