I can not find the error of this Stored procedure

-1
delimiter $$
create procedure reposta(out mensagem varchar(100))
begin
  if new.codigo_veiculo != null then
  set mensagem = "Algum veículo está sendo utilizado";
end $$
delimiter ;

error that appears

  

Code: 1064. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5

    
asked by anonymous 12.06.2017 / 14:56

1 answer

0

Correction:

For all IF it is necessary to include a END IF; as below:

delimiter $$
create procedure reposta(out mensagem varchar(100))
begin
  if (new.codigo_veiculo != null) then
     set mensagem = "Algum veículo está sendo utilizado";
  end if;
end $$
delimiter ;
    
12.06.2017 / 15:16