Home  >  Article  >  Database  >  What is the difference between stored procedures and functions?

What is the difference between stored procedures and functions?

王林
王林forward
2023-09-04 20:21:021195browse

What is the difference between stored procedures and functions?

The following are the main differences between functions and procedures:

Function th> Procedure
#A function has a return type and returns a value. td> The procedure has no return type. But it uses OUT parameter to return value.
You cannot use functions with data manipulation queries. Only select queries are allowed in functions. You can use DML queries in procedures such as insert, update, select, etc.
Functions do not allow output parameters Procedures allow input and output parameters.
You cannot manage transactions within a function. You can manage transactions within a process.
You cannot call a stored procedure from a function You can call a function from a stored procedure.
You can call functions using select statements. You cannot call a procedure using a select statement.

The above is the detailed content of What is the difference between stored procedures and functions?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete