求助!需要递归调用Oracle中的存储过程,如何写这样的存储过程
求助,因为我们ERP系统中的Menu资料,是通过两个表进行存储的,F9000存是的每个MENU明细资料,F9001时存储MENU之间的上下关系。现在,我想做一个根据MENU层次来显示各ROLES的权限设置,因此需要做一个存储过程来得到一个MENU层次表,我编写如下:
create or replace procedure sp_GetSubMenu(ParentTaskid in nvarchar2(36))
is
begin
DECLARE CURSOR task_temp IS
select tmtaskid,tmtasknm,tmlngtask,tmobnm,tmver,tmfmnm
,trparnttsk,trchildtsk,trprsseq
from testctl.f9000 a,testctl.f9001 b
where a.tmtaskid=b.trchildtsk and b.trchildtsk=ParentTaskid
order by trprsseq ;--
for Cur_Row in task_temp loop
begin
insert intoJDE_GMIMenu(taskid, taskname , objname, objver,objform )
values(Cur_Row.trchildtsk,Cur_Row.tmtasknm,Cur_Row.tmobnm,Cur_Row.tmver,Cur_Row.tmfmnm); --将当前层次保存在一个临时表中
commit;
executesp__GetSubMenu(Cur_Row.trchildtsk);--这里递归调用下一层次
end;
end loop;
CLOSE task_temp;
end sp_GetSubMenu;
但是不能执行这个存储过程,请各位高手帮我看看,就如何写
|