Answers for "HOW OT MAKE A STORED PROCEDURE MYSQL"

SQL
3

mysql create stored procedure

-- MySQL

-- example
DELIMITER $$ -- Changes delimiter to $$ so can use ; within the procedure
CREATE PROCEDURE select_employees()
BEGIN
	select * 
	from employees 
	limit 1000; -- Use the ; symbol within the procedure
END$$ 
DELIMITER ; -- Resets the delimiter

/* syntax:
DELIMITER $$ -- Changes delimiter to $$ so can use ; within the procedure
CREATE PROCEDURE <Your-procedure-name>(<argument1><argument2>...<argumentN>)
BEGIN
	<Code-that-stored-procedure-executes>; -- Use the ; symbol within the procedure
END$$
DELIMITER ; -- Resets the delimiter
*/
Posted by: Guest on May-19-2020
2

MySQL Stored Procedures

DELIMITER $$

CREATE PROCEDURE GetCustomers()
BEGIN
	SELECT 
		customerName, 
		city, 
		state, 
		postalCode, 
		country
	FROM
		customers
	ORDER BY customerName;    
END $$

DELIMITER ;


-- Once you save the stored procedure, you can invoke it by using the CALL statement:

CALL GetCustomers();
Posted by: Guest on May-19-2021

Code answers related to "HOW OT MAKE A STORED PROCEDURE MYSQL"

Code answers related to "SQL"

Browse Popular Code Answers by Language