create procedure proc_delete_cronjob(IN injobname varchar(200), IN intriggername varchar(200))
BEGIN
-- 定义返回结果并赋初值0
DECLARE result_code INTEGER DEFAULT 0; 
-- 在执行过程中出任何异常设置result_code为1
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET result_code=1; 
-- 开始事务
START TRANSACTION;
--  1删除定时时间表
delete FROM qrtz_cron_triggers WHERE trigger_name=intriggername;
-- 2删除定时任务触发表
DELETE FROM qrtz_triggers WHERE trigger_name=intriggername;
-- 3删除定时任务任务表
DELETE FROM qrtz_job_details WHERE job_name=injobname;
-- 4删除短信模板配置表
DELETE FROM mSG_CONFIG WHERE jobname=injobname;
IF result_code = 1 THEN -- 可以根据不同的业务逻辑错误返回不同的result_code，这里只定义了1和0
         ROLLBACK; 
     ELSE 
         COMMIT; 
     END IF;
SELECT result_code, case when result_code=0 then '删除定时任务成功'
else  '删除定时任务失败' end result ;
END;

