AES_ENCRYPT duplicate error
Hi,
I'm trying to understand which record is causing duplicate key error.
mysql> create table t_raw (id smallint, cod varchar(20));
mysql> create table t_enc (id smallint, cod varbinary(100));
mysql> create unique index idx_enc on t_enc (cod);
mysql> insert into t_raw (id,cod) values (1,'Adam');
mysql> insert into t_raw (id,cod) values (2,'Adam');
mysql> insert into t_raw (id,cod) values (3,'Clayton');
mysql> insert into t_raw (id,cod) values (4,'Reginald');
mysql> SET @key = 'HELLO';
mysql> insert into t_enc select id, AES_ENCRYPT(cod,@key) from t_raw;
ERROR 1062 (23000): Duplicate entry '\x9CI)(\xC5\xE7\xC1f\x93O\x83\xA4\x80\xB3\xD0\xCB' for key 'idx_enc'
How can I guess that the duplicate is 'Adam'?
Thank you for your help!
Subject
Written By
Posted
AES_ENCRYPT duplicate error
December 20, 2017 10:51AM
December 20, 2017 11:19AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.