Stored procedure arguments: in parentheses in the stored procedure, you can declare parameters. The syntax is:CREATE PROCEDURE P ([in/out/inout] parameter Name argument type ...) , the MySQL stored procedure parameter will default to in if not explicitly specified in, out, InOut
In: parameters for incoming function
Create procedureP7 (inchNint)begin DeclareNumint default 0; DeclareTotalint default 0; whileNum<=N doSetTotal:=Total+num; SetNum:=Num+ 1; End while; SelectTotal ;End$
Invoke: Call-------->5050 (1+2+3+....+100)/call (+)--------------->55 (1+2+3+.........+10)
Out: An external variable that can be understood as a function to be changed, regardless of what value the variable is outside, the initial value inside is null, and the internal effect on it will change the value of the external variable, that is, the value of the function calculation is mapped to the outside of the function
Create procedureP8 (inchNint, out Totalint)begin DeclareNumint default 0; SetTotal:= 0; whileNum<=N doSetTotal:=Total+num; SetNum:=Num+ 1; End while;End$
Invoke: Call P8 (10,@C); Select @c;-----------------> Printing 55
InOut: declares global for a function internally and may modify the value of the variable
Create procedure int begin set Age:=+; End$
Call: Set @age: = 20; Call P9 (@age); Select @age; Printing 40
Parameters of the stored procedure