This discussion is archived
3 Replies Latest reply: Aug 9, 2013 2:45 PM by ChrisJenkins RSS

Update fails with 'Unique constraint violated' error

dparhonin Newbie
Currently Being Moderated

Hi all,

 

I don't understand the following:

 

Command> create table test (ID TT_BIGINT PRIMARY KEY, EMAIL VARCHAR(128), MSISDN

VARCHAR(20));

Command> create unique index MSISDN__UNIQUE on test (MSISDN ASC);

Command> create unique index EMAIL__UNIQUE on test (EMAIL ASC);

Command> insert into test values (1, 'deps@d.d', '2222222');

1 row inserted.

Command> update test set EMAIL='deps@d.d' where ID=1;

  907: Unique constraint (EMAIL__UNIQUE) violated at Rowid <BMUFVUAAAA1AQAACDg>

The command failed.

 

Why do I have the unique constraint violation here? I'm changing the EMAIL value to the same value!

 

Thanks in advance,

Dmitriy.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points