Creating Stored Procedures and Functions in MySQL

Published July 26, 2025 By Sai Sree Ram Gundepudi

Stored Procedure

DELIMITER //
CREATE PROCEDURE GetHighSalary()
BEGIN
  SELECT * FROM employees WHERE salary > 70000;
END //
DELIMITER ;

Stored Function

CREATE FUNCTION TaxAmount(salary DECIMAL(10,2))
RETURNS DECIMAL(10,2)
RETURN salary * 0.1;

Was this solution helpful?

Your feedback helps improve our technical knowledge repository.

Share this article