Mysql (12) links to the stored procedure: Mysql (1) Installation of mysql http://www.bkjia.com/database/201210/162314.html Mysql (2) Database Operations http://www.bkjia.com/database/201210/162315.html Mysql (3) operations on Data Tables http://www.bkjia.com/database/201210/162316.html Mysql (4) Data Table query operations http://www.bkjia.com/database/201210/162317.html Mysql (5) operation time http://www.bkjia.com/database/201210/162318.html;Mysql Those things (6) String Pattern Matching http://www.bkjia.com/database/201210/163969.html;Mysql Those things (7) In-depth select query http://www.bkjia.com/database/201210/163970.html;Mysql Those things (8) Index http://www.bkjia.com/database/201210/163971.html Mysql (9) common functions http://www.bkjia.com/database/201210/164229.html Mysql (10) trigger 1 http://www.bkjia.com/database/201210/164516.htmlMysql Those things (11) trigger 2 http://www.bkjia.com/database/201210/164766.html A stored procedure is a collection of SQL statements stored in the database after compilation. Example: The Stored procedure syntax www.2cto.com SQL code create procedure proc_name (proc_peremeter1 ,.....) -- stored procedure name and parameter [characteristic...] routine_body -- syntax for calling a stored procedure call SQL code call proc_name -- call a stored procedure example to create a stored procedure. Of course, before creating a stored procedure, create a table, to learn how to CREATE a simple TABLE structure, the SQL code CREATE TABLE filmall (id smallint (5) NOT NULL, film_id smallint (6) NOT NULL, name varchar (40) DEFAULT NULL, store_id smallint (6) not null, txt text, primary key ('id ')) Www.2cto.com inserts data into the data table. Write a simple stored procedure: SQL code -- the stored procedure name is proc_film_store and the parameters are three: the first two are input, the subsequent SQL code delimiter $ SQL code create procedure proc_film_store (IN p_film_id INT, IN p_store_id INT, OUT p_film_count INT) begin select txt FROM filmall WHERE film_id = p_film_id AND store_id = p_store_id; SELECT FOUND_ROWS () INTO p_film_count; -- put the number of entries INTO the variable END $ SQL code delimiter; now you can call the stored procedure. SQL code call proc_film_store (, @ a); --- input parameter -- after execution, the queried data will be output www.2cto.com -- the number of queried results will be output select @; the stored procedure is OK. SQL code -- note that when writing a stored procedure, the following command is generally used -- before writing a stored procedure, change the terminator delimiter $ -- this statement means to replace the Terminator with $ -- after writing the stored procedure, change the terminator back to delimiter;