Archive for July 5, 2008

How to Create a Stored Procedure in MySQL

Posted in MySQL, SQL, programming with tags on July 5, 2008 by Joey

A procedure can be creating in MySQL by using the following syntax:

CREATE PROCEDURE ProcedureName
(
param1 int,
param2 varchar(20)
)
BEGIN
– Text of stored procedure here
END;

Note that the name of the parameters cannot be the same as the names of any columns in tables that are referenced within the stored procedure.