#Parameters make stored procedures more useful and flexible. In MySQL we have following three modes -
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 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 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.
The following is the syntax for defining parameters in a stored procedure-
MODE parameter_name parameter_type(parameter_size)
Here, MODE can be IN, OUT or INOUT, depending on the storage The purpose of the parameters in the purpose.
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!