I'm looking at MySQL procedures and functions. What is the real difference?
They seem to be similar, but a function has more limitations.
I'm likely wrong, but it seems a procedure can do everything and more than a function can. Why/when would I use a procedure vs a function?
You can't mix in stored procedures with ordinary SQL, whilst with stored function you can.
e.g. SELECT get_foo(myColumn) FROM mytable
is not valid if get_foo()
is a procedure, but you can do that if get_foo()
is a function. The price is that functions have more limitations than a procedure.