What is the difference between MySQL stored procedure and function?


Stored Procedure

In MySQL, a stored procedure can be called with the help of call statement. A stored procedure returns more than one value.

A stored procedure returns 0 by default. It cannot be used in SQL query and is based on precompile.

Function

A function can be called inside the statement. It can return a value with the help of return statement and it returns only one value.

A function returns any single value, which can be a table. It can be used in SQL query and isn’t based on precompile.

Updated on: 30-Jul-2019

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements