Skip to content
Advertisement

Not allowed to return a result ? stored procedure mysql

Advertisement

Answer

If you want to set a variable to the result of a SELECT query, you need to use SELECT ... INTO variable, not SELECT ... AS variable. Your function is trying to return the result of the SELECT query because it doesn’t store the result into a variable.

Or you can use SET statement, which is simpler when you’re just setting a single variable.

So replace the two SELECT statements with:

Also, you shouldn’t have DECLARE statements for the function parameters. Remove the line

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement