apzl_leasing/src_sql/procedure/proc_delete_DaiMaGuanLi.sql

22 lines
974 B
SQL
Raw 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_DaiMaGuanLi(IN incodeno varchar(200))
BEGIN
DECLARE result_code INTEGER DEFAULT 0; -- 定义返回结果并赋初值0
DECLARE CODE_CATALOG_number INTEGER DEFAULT 0; -- 定义返回结果并赋初值0
DECLARE Code_Library_number INTEGER DEFAULT 0; -- 定义返回结果并赋初值0
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION SET result_code=1; -- 在执行过程中出任何异常设置result_code为1
-- 删除显示模板
select sum(1) a into CODE_CATALOG_number from CODE_CATALOG where codeno=incodeno;
DELETE FROM CODE_CATALOG where codeno=incodeno;
select sum(1) into Code_Library_number from Code_Library where codeno=incodeno;
DELETE FROM Code_Library WHERE codeno=incodeno;
IF result_code = 1 THEN -- 可以根据不同的业务逻辑错误返回不同的result_code这里只定义了1和0
ROLLBACK;
ELSE
COMMIT;
END IF;
SELECT result_code,CODE_CATALOG_number,Code_Library_number;
END;