I followed the example provided in our class material and made a function that returns a count. Now I am trying to make a function that would get me the full name of a user by the same principle I made the count function but I keep getting this error:
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 '' at line 4
CREATE FUNCTION getAuthorFullName (authorID INT)
RETURNS CHAR(45)
BEGIN
DECLARE author CHAR(45);
SELECT CONCAT(first, ' ',last) FROM person as fullName
JOIN user ON user.idPerson = fullName.idPerson
WHERE idUser LIKE authorID
INTO author;
RETURN author;
I checked the SELECT query on its own and it retrieves the correct full name of the author when I pass the authors ID manually so I just have to get it working in a function where I can simply pass the author's ID.