Trying to run a function in SQL with a Select statement nested inside, can't get it to work. New to this so I could use the help. Here's my code:
DELIMITER//
CREATE FUNCION whereAndWhen(species, VARCHAR(255))
RETURNS INT()
BEGIN
SELECT animals.zone
FROM animals
WHERE animals.species = species;
RETURN;
END; //
DELIMITER ;
The goal is for the function to accept an animal species name and receive the zone where that animal lives, all from the same table. Any tips?