title: mySQL Function to make address string
body: <p>I want to have a mySQL function that returns a string which is based on input parameters. So I have no blanks.</p>
  
  <p>I tried the following but it tells me there is a syntax error at the beginning but I cannot see it.</p>
  
  <pre><code>CREATE DEFINER = CURRENT_USER FUNCTION `NewProc`(`add1` varchar,`add2` varchar,`add3` varchar,`town` varchar,`USState` varchar,`pcode` varchar,`country` varchar)
      RETURNS varchar(250)
  
      BEGIN
      DECLARE fulladdress VARCHAR;
  
      fulladdress = add1;
      if (add2 &lt;&gt;'')
          {fulladdress = CONCAT(fulladdress,', ',add2);}
      if (add3 &lt;&gt; '')
          {fulladdress = CONCAT(fulladdress,', ',add3);}
      fulladdress = CONCAT(fulladdress,', ',town);
      if (USState &lt;&gt; '')
          {fulladdress = CONCAT(fulladdress,', ',USState);}
      if (pcode &lt;&gt; '')
          {fulladdress = CONCAT(fulladdress', ',pcode;}
      fulladdress = CONCAT(fulladdress,', ',country)};
  
      RETURN fulladdress;
      END;
  </code></pre>