I can not get through the MySQL Database to control that everything is inserted in upper case, or update after inserting.
I have the following trigger in the table paises
( idPasi
, pais
):
CREATE DEFINER = CURRENT_USER TRIGGER 'tf-modelo-de-datos'.'paises_AFTER_INSERT' AFTER INSERT ON 'paises' FOR EACH ROW
BEGIN
UPDATE tf.paises SET pais = UPPER(pais);
END
But when I insert a new country, I get the following error:
Operation failed: There was an error while applying the SQL script to the database Executing: INSERT INTO
tf
.paises
(pais
) VALUES ('Argentina');ERROR 1442: 1442: Can not update table 'countries' in stored function / trigger because it is already used by statement which invoked this stored function / trigger. SQL Statement: INSERT INTO
tf
.paises
(pais
) VALUES ('Argentina')
I read something that was trying to modify the same data twice at the same time.
Does anyone know any way to do this control in the most efficient way possible, but at the Database level?.