I've made this function but no matter what I add (delimiters) it's still throwing the same error.
CREATE FUNCTION getNumberOfBuyers(IN userId INT) RETURNS INT
BEGIN
DECLARE numberOfBuyers INT DEFAULT 0;
SELECT COUNT(*) INTO numberOfBuyers FROM buyers WHERE id = userId;
RETURN numberOfBuyers;
END;
The error is:
[42000][1064] You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'IN userId INT) RETURNS INT BEGIN DECLARE numberOfBuyers INT DEFAULT 0; ...' at line 1