Stored Procedures and functions:
To create the sample code:
DELIMITER $ $CREATE PROCEDURE proc (in c_id int, in C_name VARCHAR (a), out Count INT) READS SQL databegin SELECT * F ROM course WHERE cou_no = c_id OR cou_name = c_name; SELECT found_rows () into count; END $ $DELIMITER
Other:
1. A stored procedure or function can call other procedures or functions.
2. {READS SQL data| Modifies SQL data|no sql| CONTAINS SQL}: These eigenvalues provide intrinsic information about the use of the data by the subroutine, which is currently provided only to the server, and does not constrain the actual use of the data based on these eigenvalue values.
- READS SQL Data: A statement that represents a subroutine that contains read data, but does not contain a statement that writes data.
- Modifies SQL data: Represents the statement that the subroutine contains write data.
- No SQL: Indicates that the subroutine does not contain SQL statements.
- CONTAINS SQL: Represents a statement that the subroutine does not contain read or write data.
If these features are not explicitly given, the default value used is contains SQL.
Test code (performed separately):
Call proc (1, ' Information system ', @a); SELECT @a;
To delete a stored procedure or function code:
DROP PROCEDURE proc;
Navicat Creating stored procedures and Function procedures:
1. Click function, new function
2. Select "Process"
3. Start editing stored procedures or functions
4. Click "Save" to fill in the name
MySQL stored procedures and functions