How do you use calling a stored procedure with an example?

In MySQL, a stored procedure is a precompiled collection of one or more SQL statements that can be executed as a single unit. You can call a stored procedure using the CALL statement. Below is a simple example demonstrating how to create and call a stored procedure.

Stored Procedure Example

-- Creating a stored procedure DELIMITER // CREATE PROCEDURE GetEmployeeDetail(IN empID INT) BEGIN SELECT * FROM Employees WHERE EmployeeID = empID; END // DELIMITER ; -- Calling the stored procedure CALL GetEmployeeDetail(1);

mysql stored procedure call procedure sql example database management