创建或替换过程 proc_query_prior_departmentisCursor Department_list_nosub isselect dep.id,dep.name,dep.paren
创建或替换过程 proc_query_prior_department
是
光标department_list_nosub是
从部门dep中选择dep.id,dep.name,dep.parent,其中org_id=7;
union_mc varchar2(200);
开始
从 ma_department_role 中删除;
提交;
for Department_list_nosub 循环中的 varDep
for cur in(从部门 t 中选择 t.parent,t.name,以 t.id=varDep.id 开头,按之前的 t.parent =t.id 连接,按 t.id asc 排序)循环
if cur .parent 不为空
if(union_mc 为空) then
union_mc := cur.name;
else
union_mc :=union_mc||'/'||cur.name;
结束如果;
end if;
结束循环;
插入 ma_department_role(id,name)values(varDep.id,union_mc);
union_mc:=null;
结束循环;
提交;
结束;