2
Good afternoon, you guys.
I would like to know if there is a possibility of UPDATE
for NULL
where the field allows only values UNIQUE
.
I tried that way:
update FUNCIONARIO set codigocartao = NULL where situacao = 'DESATIVADO'
But returned me duplicate registry error.
The scenario I need is, the code field should have a unique record, but it can also be null.
the scenario I have today is: every time I need to set the field to NULL
, I end up having to delete the table.
I’m doing something wrong or this possibility does not exist in MySQL
?
Does anyone have any idea?
In theory it is possible pq one null is never equal to another.
codigocartao
is FK too? could put original error message? and table setting.– rray
rray, no, the field was set with UNIQUE and NOT NULL (this the problem). thanks.
– Iago Correia Guimarães