I’m using xampp with phpMyAdmin to manage a MySql database.
When creating a function I got a “No Return Found” error, so I stripped down the function to narrow the origin of the error I got to the simplest case where it still doesn’t work.
And the error message is this:
Apparently if the RETURN
statement isn’t the only thing on the code I get an error.
2
Answers
When reviewing this post I was reading more carefully the error message I realized the MySql code to define the function didn't have
BEGIN
andEND
in it.I assumed when typing function code with several lines that phpMyAdmin would know how to handle it, since the code text box has support to multiple lines of code.
So, putting
BEGIN
at the beginning andEND
at the end of the code solved my problem.Assuming the actual code being executed against MySQL is:
This will fail, because you have not wrapped the function in
BEGIN
…END
.Try instead to write this as your function declaration:
Alternatively, declare the function yourself directly in MySQL: