title: What is the matter with if statement in procedure?
body: <p>It is simple to write a sql procedure.</p>
  
  <pre><code>demiliter //
  create procedure show_growth()
  begin
  SELECT * from tb;
  end //
  </code></pre>
  
  <p>I want to add a if statement in the procedure.<br>
  Drop it first.</p>
  
  <pre><code> drop procedure show_growth //
  </code></pre>
  
  <p>Then create a new one.</p>
  
  <pre><code>create procedure show_growth(in type char(3))
      -&gt; begin
      -&gt; if type = "all" then 
      -&gt; SELECT * from tb;
      -&gt; endif
      -&gt; end //
  </code></pre>
  
  <p>ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'end' at line 6</p>
  
  <p>How to fix it?</p>