I can’t find the error of this Stored Procedure

Asked

Viewed 38 times

-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

  • 2

    lacked the end if; after setting the value in mensagem

  • worked thanks....

1 answer

0

Correction:

For all IF the inclusion of 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 ;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.