Frequently Asked Questions

Are stored procedures supported in MySQL?

Last Updated: March 29, 2007 1:51 PM

Stored procedures are supported in MySQL 5.0. A stored procedure is a set of SQL statements that can be stored in the server. Once this has been done, clients don't need to keep reissuing the individual statements but can refer to the stored procedure instead.

An example of an allowed stored procedure:

DELIMITER $$
DROP PROCEDURE IF EXISTS `spGetSouls`$$

CREATE PROCEDURE `spGetSouls`()
DETERMINISTIC
BEGIN
SELECT * FROM soul;
END$$
DELIMITER ;

CALL spGetSouls();

NOTE:Be sure that your stored procedures are labeled as DETERMINISTIC

For more information on stored procedures, see the MySQL Web site and Stored Procedures Frequently Asked Questions.