Home > Database > Mysql Tutorial > body text

What is the difference between stored procedures and functions?

王林
Release: 2023-09-04 20:21:02
forward
1261 people have browsed it

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template