Skip to content
Advertisement

sql stored function gives an error

I am trying to create a stored function to take one parameter called budget. The function should return the string ‘LOW’ for a budget less than or equal to 500000, ‘MID’ for a budget less than or equal to 850000, ‘HIGH’ for a budget less than or equal to 1200000, and ‘ULTRA’ for a budget above 1200000. But I am getting an error that doesn’t make much sense to me.

Here is my function:

I am still new to sql, so this syntax is based on examples online and such. Here is my error:

Can anyone help me figure out what this means?

Advertisement

Answer

The syntax for stored function is

So you have made two mistakes, you use procedure instead of function and you miss the RETURNS <type> part. Try

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