title: MYSQL function, is it Workbench or just noobish me?
body: <p>I have been sitting with a stored procedure for MySQL for days now, it just won't work, so I thought I'd go back to basic and do a very simple function that checks if an item exists or not.</p>
  
  <p>The problem I had on the first one was that it said END IF is invalid syntax on one of my IF clauses, but not the other two. The second one won't even recognize BEGIN as valid syntax...</p>
  
  <p>Is it I that got everything wrong, or have I stumbled upon a MYSQL Workbench bug? I have Workbench 5.2 (latest version when I'm writing this) and this is the code:</p>
  
  <pre><code>DELIMITER $$
  
  CREATE FUNCTION `filmsidan`.`f_lateornot` (movie_id INT)
  BEGIN
      DECLARE check_val INT;
      DECLARE return_val INT;
  
      SELECT stockId
      FROM orders
      WHERE stockId = movie_id
      INTO check_val;
  
      IF check_val &lt;= 0
      THEN
          SET return_val = 1;
      ELSE
          SET return_val = 0;
      END IF;
  
      RETURN return_val;
  
  END
  </code></pre>