delimiter || 
create function shorten(s varchar(255),n int)
 returns varchar(255); begin
 if isnull(s) then
  return '';
 else if n<15 then
  return left(s,n);
 else
   if char_length(s)<=n then
      return s;
   else 
      return concat(left(s,n-10),'...',right(s,5));
   end if;
  end if;
end||出现
ERROR 1064 (42000): 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 ';
 begin
 if isnull(s) then
  return '';
 else if n<15 then
  return left(s,n);
' at line 2