Summary: in this tutorial, we will show you step by step how to develop the first MySQL stored procedure by using CREATE PROCEDURE statement. In addition, we will show you how to call the stored procedures from SQL statements.
Writing the first MySQL stored procedure
We are going to develop a simple stored procedure namedGetAllProducts() to help you get familiar with the syntax. The GetAllProducts() stored procedure selects all products from the products table.
DELIMITER //
CREATE PROCEDURE GetAllProducts()
BEGIN
SELECT * FROM products;
END //
DELIMITER ;
No comments:
Post a Comment