Stored Procedures
???? Store multiple steps to complete a feature to define multiple calls at once.
???? is a function that has no return value.
Create
1th Step: Change Terminator
2nd step: Create a process
???? CREATE PROCEDURE procedure name ( direction parameter 1 type, direction parameter 2 type ...)
???? Begin
???????? --Process body
???? End
3rd Step: Restore Terminator
Direction of the formal parameter:
Ins
Out
InOut
Example:
To view stored procedures:
Show procedure status;
Example:
Calls to Stored procedures
Syntax
???? Call Procedure name (argument);
Example:
The formal parameter direction of the process
In???????? Indicates that data can only be passed to formal parameters, not outgoing
Out???????? Indicates that data can only be passed out, but cannot receive data that is passed in
InOut???? That is, you can receive incoming data, and you can pass the data out.
Out and InOut are reference methods, so a variable must be used for a formal parameter corresponding to an out and inout type.
Example 1:
The difference between a function and a stored procedure:
1. function must have return
2. Stored procedure cannot have return
3, function body can not have select
4. The stored procedure body can have select
5. Function parameters have no direction
6, the parameter of the stored procedure has the direction
Mysql Stored Procedures