MySQl存儲過程例子
阿新 • • 發佈:2017-08-21
exceptio logs warning out var back del ttl tms
DELIMITER $$ USE `weipansettlementdb`$$ DROP PROCEDURE IF EXISTS `proc_demo`$$ CREATE DEFINER=`weipan_jy`@`localhost` PROCEDURE `proc_demo`( p_demo VARCHAR(8), #參數 OUT op_code INT, #小於0為錯誤代碼, 大於0為委托單號 OUT op_msg VARCHAR(30) #返回信息 ) MODIFIES SQL DATA proc_demo: BEGIN DECLARE v_demo VARCHAR(8); DECLARE EXIT HANDLER FOR SQLEXCEPTION BEGIN SHOW WARNINGS; ROLLBACK; SET op_code=-1; SET op_msg=`flot_getmsg`(-1); END; SET op_code=-1; SELECT `demo` INTO v_demo FROM `t_demo` WHERE `demo` = p_demo; IF v_demo = p_demo THEN LEAVE proc_demo; END IF; START TRANSACTION; COMMIT; SET op_code = 0; SET op_msg=`flot_getmsg`(0); END$$ DELIMITER ;
MySQl存儲過程例子