drop procedure proc_fi_deptment;
DELIMITER //
create PROCEDURE proc_fi_deptment()
BEGIN
/* 标记是否出错/
declare t_error int default 0;
/* 标记是否跳出循环/
DECLARE flag int default 1;
#层级
DECLARE cj int default 0;
#下层级
DECLARE cjnext int default 0;
#个数
DECLARE sl int default 0;
/** 如果出现sql异常,则将t_error设置为1后继续执行后面的操作 */
declare continue handler for sqlexception set t_error=1; # 出错处理
# 开始事务
START TRANSACTION;
#创建未分层级的临时表
delete from ofs_fi_department_temporary ;
insert