I'm a student and I'm trying to get my function to return the result of my select, but I don't know what to put in the RETURN
.
I have tried to create functions with mathematical operations for example, and it works correctly for example:
DELIMITER $$
CREATE FUNCTION `getScore`(`a` INT, `b` INT, `c` INT) RETURNS INT
BEGIN
RETURN a + b + c;
END$$
DELIMITER ;
SELECT getScore(0.3, 0.4, 0.5);
But my problem is in this function, I don't know what to put in the RETURN
or how to scrutinize the function:
DELIMITER $$
CREATE FUNCTION `getCharacters`() RETURN
BEGIN
SELECT *
FROM `characters`
WHERE `level` > 50
END$$
DELIMITER ;
SELECT getCharacters();
I have the next error:
A "RETURNS" keyword was expected. (near "RETURN" at position 34)
Thank you for any help and excuse me for my English.