Mysql stored procedures and functions are a collection of SQL statements edited and stored in the database. Calling stored procedures and functions can simplify the work of application developers, reduces data transmission in databases and applications to improve the processing capability of mysql databases.
1. What are stored procedures and functions?
Mysql tutorial stored procedures and functionsIt is a collection of SQL statements that have been edited and stored in the database tutorial. Calling stored procedures and functions can simplify the work of application developers and reduce data transmission in databases and applications, this improves the processing capability of the mysql database.
2. Create and modify stored procedures and functions related to stored procedures.
CreateStored Procedures and creation Functions
Create procedure sp_name ()
Create function sp_name ()
Instance that calls the Stored Procedure
Call sp_name ();
You can include dll statements in the mysql stored procedure.Stored ProcedureRun commit, rollback, and so on, but note that the stored procedure cannot contain the load data infile statement. Let's look at an instance that creates a stored procedure.
Mysql> delimiter $;
Mysql>Create procedureSp_bKjia.c0m (in url int, in sitename int, out infodesc int)
-> Reads SQL data
-> Begin
-> Select * from su where url = sitename and domain = 'www. bKjia. c0m'
-> Select foun_rows () into p_asd;
-> End $;
-> Delimiter;
Note: The above is a simple Stored Procedure instance used to query the data of domain = 'www. bKjia. c0m' and return it.
Okay. The source www. bKjia. c0m is reprinted in the original tutorial on this site.