Create Stored Procedure MySql

How to add stored procedure on your database, first you must prepare query will included to procedure. For the example :

Create Procedure :

DELIMITER //
CREATE PROCEDURE diarycoding_proc
(IN param CHAR(20))
BEGIN
  SELECT Name, category FROM Post
  WHERE category = param;
END //
DELIMITER ;

And then call the procedure :

CALL diarycoding_proc('SQL');

www.diarycoding.com

Leave a Comment.