Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Can't Update Value because of constraint :: WEIRD!
On Thu, 02 Oct 2003 02:25:24 -0600, Lee <now_at_yjo.se> wrote:
>Hi!
>
>I'm no stranger to SQL, but I am to Oracle. I'm having a little problem
>trying to update a field that has a constraint on it. My table is
>similar to this below:
>
>create table myTable
>(
> id NUMBER(38) CONSTRAINT myFK REFERENCES anotherTable
> status VARCHAR2(10) default 'good',
> CONSTRAINT myPK PRIMARY KEY (plate_id),
> CONSTRAINT statuschk CHECK (plate_status in ('good', 'bad', 'ugly',))
>);
>
>When I try and execure the following:
>update myTable set status = 'bad' where id = 96
>
>I get:
>ERROR at line 1:
>ORA-02290: check constraint (blag.STATUSCHK) violated
>
>What mistake am I making? 'bad' is allowed, but it's breaking the
>constraint...
Compare 'Status' to 'plate_status'
-- Sybrand Bakker, Senior Oracle DBAReceived on Thu Oct 02 2003 - 15:35:35 CDT