程序中的 if 语句有什么问题?

What is the matter with if statement in procedure?

写个sql程序很简单

demiliter //
create procedure show_growth()
begin
SELECT * from tb;
end //

我想在过程中添加一个 if 语句。
先放下。

 drop procedure show_growth //

然后创建一个新的。

create procedure show_growth(in type char(3))
    -> begin
    -> if type = "all" then 
    -> SELECT * from tb;
    -> endif
    -> end //

ERROR 1064 (42000):您的 SQL 语法有误;查看与您的 MariaDB 服务器版本对应的手册,了解在第 6

行 'end' 附近使用的正确语法

如何解决?

endif 不是 1 个单词。

 begin
   if type = "all" then    
    SELECT * from tb;
   end if;
 end