3 Replies Latest reply: Aug 9, 2013 4:45 PM by Chrisjenkins-Oracle RSS

    Update fails with 'Unique constraint violated' error

    dparhonin

      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.