create procedure proc_delete_FengXianYuJin(IN inscenarioid varchar(200))
BEGIN
DECLARE result_code INTEGER DEFAULT 0; -- 定义返回结果并赋初值0
DECLARE SCENARIO_CATALOG_number INTEGER DEFAULT 0; -- 定义返回结果并赋初值0
DECLARE SCENARIO_MODEL_number INTEGER DEFAULT 0; -- 定义返回结果并赋初值0
DECLARE SCENARIO_ARGS_number INTEGER DEFAULT 0; -- 定义返回结果并赋初值0
DECLARE SCENARIO_GROUP_number INTEGER DEFAULT 0; -- 定义返回结果并赋初值0
DECLARE SCENARIO_RELATIVE_number INTEGER DEFAULT 0; -- 定义返回结果并赋初值0
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET result_code=1; -- 在执行过程中出任何异常设置result_code为1
--  删除显示模板
SELECT SUM(1) a INTO SCENARIO_CATALOG_number FROM SCENARIO_CATALOG WHERE scenarioid=inscenarioid;
DELETE FROM SCENARIO_CATALOG WHERE scenarioid=inscenarioid;
SELECT SUM(1) INTO SCENARIO_MODEL_number FROM SCENARIO_MODEL WHERE scenarioid=inscenarioid;
DELETE FROM SCENARIO_MODEL WHERE scenarioid=inscenarioid;
SELECT SUM(1) INTO SCENARIO_ARGS_number FROM SCENARIO_ARGS WHERE scenarioid=inscenarioid;
DELETE FROM SCENARIO_ARGS WHERE scenarioid=inscenarioid;
SELECT SUM(1) INTO SCENARIO_GROUP_number FROM SCENARIO_GROUP WHERE scenarioid=inscenarioid;
DELETE FROM SCENARIO_GROUP WHERE scenarioid=inscenarioid;
SELECT SUM(1) INTO SCENARIO_RELATIVE_number FROM SCENARIO_RELATIVE WHERE scenarioid=inscenarioid;
DELETE FROM SCENARIO_RELATIVE WHERE scenarioid=inscenarioid;
    
IF result_code = 1 THEN -- 可以根据不同的业务逻辑错误返回不同的result_code，这里只定义了1和0
         ROLLBACK; 
     ELSE 
         COMMIT; 
 END IF;
 SELECT result_code,SCENARIO_CATALOG_number,SCENARIO_MODEL_number,SCENARIO_ARGS_number,SCENARIO_GROUP_number,SCENARIO_RELATIVE_number;    
    
 END;

