Trying to create a stored function but keep getting the same error.
I've tried a different body, changing integer
to INT
with/out (11)
DELIMITER $$
CREATE FUNCTION f_media (@dag INT, @week INT, @medium_naam varchar)
RETURNS integer
BEGIN
DECLARE result INT(11);
SELECT result=COUNT(medium_name) FROM `TABLE 4` WHERE WEEK(date) = @week AND DAYOFWEEK(date) = dag AND medium_name == @medium_naam GROUP BY date;
RETURN result;
END $$
DELIMITER ;
This is the exact error:
MySQL said:
#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
'@dag INT, @week INT, @medium_naam varchar)
RETURNS integerBEGIN
DECLA' at line 1