apzl_leasing/src_sql/procedure/proc_delete_xianshimoban.sql

25 lines
1.2 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

create procedure proc_delete_xianshimoban(IN indono varchar(200))
BEGIN
DECLARE result_code INTEGER DEFAULT 0; -- 定义返回结果并赋初值0
DECLARE AWE_DO_CATALOG_number INTEGER DEFAULT 0; -- 定义返回结果并赋初值0
DECLARE awe_do_library_number INTEGER DEFAULT 0; -- 定义返回结果并赋初值0
DECLARE AWE_DO_Group_number INTEGER DEFAULT 0; -- 定义返回结果并赋初值0
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET result_code=1; -- 在执行过程中出任何异常设置result_code为1
-- 删除显示模板
select sum(1) a into AWE_DO_CATALOG_number from AWE_DO_CATALOG where dono=indono;
DELETE FROM AWE_DO_CATALOG where dono=indono;
select sum(1) into awe_do_library_number from awe_do_library where dono=indono;
DELETE FROM awe_do_library WHERE dono=indono;
select sum(1) into AWE_DO_Group_number from AWE_DO_Group where dono=indono;
DELETE FROM AWE_DO_Group WHERE dono=indono;
IF result_code = 1 THEN -- 可以根据不同的业务逻辑错误返回不同的result_code这里只定义了1和0
ROLLBACK;
ELSE
COMMIT;
END IF;
SELECT result_code,AWE_DO_CATALOG_number,awe_do_library_number,AWE_DO_Group_number;
END;