Hello everyone!
Please give me good examples of stored procedures in mysql5.
or give me sites with good tutorial about stored procedures.
tnx,
arjel
Hi arjel,
This is how we shall use a Stored procedure in MySQL 5.0
Example:
-
Delimiter $$
-
DROP PROCEDURE IF EXISTS getAuthors $$
-
CREATE PROCEDURE getAuthors ()
-
BEGIN
-
SELECT
-
AuthorName,
-
Address,
-
City,
-
Phone
-
FROM Author
-
END $$
-
Delimiter ;
The Delimiter should be specified else error will be thrown.Parameter can be passed in the first line of the procedure as
Create Procedure Procedurename(param1 datatype)
The procedure can be executed as
Call procedurename([parameters values])
Regards
Sivan.G
Please enclose any code within the proper code tags. See the
Posting Guidelines on how to do that.
MODERATOR