title: mysql create function syntax error
body: <pre><code>DROP PROCEDURE IF EXISTS fn_get_entity_by_username;
  
  DELIMITER $$
  CREATE function fn_get_entity_by_username
  (
      in in_username     varchar,
      out my_entity       integer
  )
  RETURNS integer DETERMINISTIC
  language SQL
  BEGIN
      declare my_entity integer(11);
      select entity
        into my_entity
        from tb_entity
       where username = in_username;
  
  END $$
  </code></pre>
  
  <p>I keep having syntax error </p>
  
  <blockquote>
    <p>ERROR 1064 (42000) at line 4: 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 'in in_username     varchar,
        out my_entity       integer ) RETURNS integer DE' at line 3'</p>
  </blockquote>