Phpmyadmin: create function

I am trying to create a function in my phpmyadmin - does not work ..: / here is my syntax:

DELIMITER $$ CREATE FUNCTION fixString(input varchar) RETURNS varchar BEGIN declare output varchar; SET output = REPLACE(input,'ΓΆ','oe'); RETURN output; END $$ DELIMITER ; 

error: # 1064 - You have an error in the SQL syntax; check the manual that matches the version of your MySQL server for the correct syntax to use next to it) RETURNS varchar BEGIN declares the output of varchar; SET output = 'on line 1

any ideas what's wrong? thanks

+4
source share
1 answer

You are using VARCHAR , so you need to specify the maximum size:

 DELIMITER $$ CREATE FUNCTION fixString(input varchar(15)) RETURNS varchar(15) BEGIN declare output varchar(15); SET output = REPLACE(input,'ΓΆ','oe'); RETURN output; END $$ DELIMITER ; 
+8
source

All Articles