I created a new column named garagem_coberta in my table. I can´t create the trigger because mysql says: unknown system variable ‘garagem_coberta’. Can someone help me?
delimiter //
create trigger update_garagem_coberta
before update on apartamento
for each row
begin
if OLD.tipo = 'cobertura' then
set garagem_coberta = 'sim'
where valor = new.valor
end if;
end ;
//delimiter ;
2
Answers
check out this documentation.
Official example from documentation
This is single-statement form, it does not need in both DELIMITER reassigning and BEGIN-END block usage.