When I insert this trigger into my database there is a slowness, coming to give this message:
Errormessage: Lock wait timeout exceeded; try restarting transaction
My trigger is as below, the cod_prod field of the products table is indexed correctly.
DELIMITER //
CREATE TRIGGER ESTOQUEENTRADA
BEFORE INSERT
ON estoque FOR EACH ROW
BEGIN
UPDATE produtos SET quant_estoque = quant_estoque + NEW.quant_prod WHERE cod_prod = NEW.cod_prod;
END;//
DELIMITER;