/* SQL Error (1064): 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 'COLLATE utf8_polish_ci
BEGIN
DECLARE segm VARCHAR(10);
DECLARE out_segm' at line 8 */
And this is the offending SQL as copied from the log:
CREATE DEFINER=`interfoto2`@`%` FUNCTION `HeidiSQL_temproutine_1`(`path` VARCHAR(255), `delim` VARCHAR(30))
RETURNS varchar(1024)
LANGUAGE SQL
DETERMINISTIC
CONTAINS SQL
SQL SECURITY DEFINER
COMMENT 'Zwraca pelna sciezke do kategorii w postaci tekstowej'
COLLATE utf8_polish_ci
BEGIN
DECLARE segm VARCHAR(10);
DECLARE out_segm VARCHAR(255);
DECLARE result VARCHAR(2000) DEFAULT '';
DECLARE i TINYINT UNSIGNED DEFAULT 0;
IF delim IS NULL THEN SET delim = ' > '; END IF;
REPEAT
SET segm = SUBSTRING_INDEX(path, '/', 1);
SET path = SUBSTR(path, LENGTH(segm)+2);
SET out_segm = (SELECT name FROM sklep_kategorie WHERE cat_id=segm LIMIT 1);
IF i > 0 THEN
SET result = CONCAT(result, delim);
END IF;
SET result = CONCAT(result, out_segm);
SET i = i + 1;
UNTIL path='' OR path IS NULL OR i > 100 END REPEAT;
RETURN result;
END;
I think the problem is with the COLLATE definition which seems to be not allowed in CREATE FUNCTION syntax.