create procedure mysql code example
Example 1: mysql create stored procedure
DELIMITER $$
CREATE PROCEDURE select_employees()
BEGIN
select *
from employees
limit 1000;
END$$
DELIMITER ;
Example 2: create delete procedure mysql
mysql> DELIMITER
mysql> Create Procedure Delete_studentinfo ( IN p_id INT)
-> BEGIN
-> DELETE FROM student_info
-> WHERE ID=p_id;
-> END
Query OK, 0 rows affected (0.11 sec)
mysql> DELIMITER ;
Example 3: create stored procedure mysql
DELIMITER $$
CREATE PROCEDURE GetAllProducts()
BEGIN
SELECT * FROM products;
END $$
DELIMITER ;
CALL GetAllProducts();