What is the difference between MySQL stored procedure and function?

MySQLMySQLi Database

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.

raja
Published on 22-Oct-2018 12:44:12
Advertisements