MySQL Stored Procedure Tutorial
I am sharing an example of MySQL stored procedure.DELIMITER $$
USE `company`$$
DROP PROCEDURE IF EXISTS `update_t`$$
CREATE DEFINER=`root`@`%` PROCEDURE `update_t`(OUT last_id INT(11),OUT last_url
VARCHAR(200))
BEGIN
SELECT company_id,company_url INTO last_id,last_url FROM company
ORDER BY id ASC LIMIT 0,1 LOCK IN SHARE MODE;
UPDATE company SET cc=1 WHERE company_id = last_id;
END$$
DELIMITER ;
No comments:
Post a Comment