Are stored procedures supported in MySQL?

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.

Note: cPanel shared hosting accounts must use remote MySQL management tools, such as MySQL Workbench to use stored procedures.

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 website and Stored Procedures Frequently Asked Questions.


Var denne artikkelen nyttig?
Takk for din tilbakemelding. For å snakke med en representant fra kundeservice, bruker du telefonnummeret til støtte eller chatte-alternativet ovenfor.
Vi er glade for å kunne hjelpe deg! Er det noe annet vi kan gjøre for deg?
Vi beklager det. Fortell oss hva som var forvirrende eller hvorfor løsningen ikke løste ditt problem.