Are stored procedures supported in MySQL?

Are stored procedures supported in MySQL?

Postby rsqguru » Fri Oct 31, 2008 9:06 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.

NOTE:This procedure applies only to Dedicated/Virtual Dedicated servers, as it requires executing the command from the MySQL command line. Customers using Shared Hosting will have to execute this procedure using phpMyAdmin, by removing the DELIMITER statements and instead using the "Delimiter" field provided in the phpMyAdmin query window.

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.
rsqguru
Site Admin
 
Posts: 33
Joined: Sat Aug 23, 2008 6:56 pm

Return to Linux

Who is online

Users browsing this forum: No registered users and 1 guest

cron

Login Form

Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 5 minutes)
Most users ever online was 15 on Sun Apr 04, 2010 7:31 pm

Users browsing this forum: No registered users and 1 guest
Copyright © 2009 Afterburner - Free GPL Template. All Rights Reserved.