Home > Database > Mysql Tutorial > What are the different modes of parameters used by MySQL stored procedures?

What are the different modes of parameters used by MySQL stored procedures?

WBOY
Release: 2023-09-06 18:09:13
forward
1280 people have browsed it

What are the different modes of parameters used by MySQL stored procedures?

#Parameters make stored procedures more useful and flexible. In MySQL we have following three modes -

IN mode

It is the default mode. When we define IN parameters in a stored procedure, the calling program must pass the parameters to the stored procedure. The value of the IN parameter is protected, which means that even if the value of the IN parameter changes within the stored procedure; its original value is retained after the stored procedure ends.

OUT Pattern

>OUT parameters can be changed inside a stored procedure and have their new values ​​passed back to the calling program. It should be noted that the initial value of the OUT parameter cannot be accessed when the stored procedure is started.

INOUT mode

INOUT parameter is a combination of IN and OUT parameters, which means The calling program can pass parameters, and the stored procedure can modify the INOUT parameters and pass the new values ​​back to the calling program.

Syntax for defining parameters

The following is the syntax for defining parameters in a stored procedure-

MODE parameter_name parameter_type(parameter_size)
Copy after login

Here, MODE can be IN, OUT or INOUT, depending on the storage The purpose of the parameters in the purpose.

  • Parameter_name is the name of the parameter.
  • Parameter_type is the data type of the parameter.
  • Parameter_size is the size of the parameter

The above is the detailed content of What are the different modes of parameters used by MySQL stored procedures?. 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