CREATE procedure p_Del_tree(p_TypeID varchar2,Level varchar2) as NewTypeID varchar(30); OldTypeID varchar(30); begin begin NewTypeID:=substr(p_typeid,1,Level*3); --资源匹配信息 delete from res_type where instr(typeid,NewTypeID)>0 and substr(rtrim(typeid),-1,3)=substr(rtrim(p_TypeID),-1,3); --权限信息 delete from grouppermission where instr(typeid,NewTypeID)>0 and substr(rtrim(typeid),-1,3)=substr(rtrim(p_TypeID),-1,3); --此节点的所有孩子 delete from type_tree where instr(parentid,NewTypeID)>0 and substr(rtrim(Parentid),-1,3)=substr(rtrim(p_TypeID),-1,3); --此节点 delete from type_tree where typeid=p_typeid; commit; dbms_output.put_line('删除成功'); exception where others then rollback; dbms_output.put_line('删除失败'); end; end; /
CREATE procedure p_Del_tree(p_TypeID varchar2,Level varchar2) as NewTypeID varchar(30); OldTypeID varchar(30); begin begin NewTypeID:=substr(p_typeid,1,Level*3); --资源匹配信息 delete from res_type where instr(typeid,NewTypeID)>0 and substr(rtrim(typeid),-1,3)=substr(rtrim(p_TypeID),-1,3); --权限信息 delete from grouppermission where instr(typeid,NewTypeID)>0 and substr(rtrim(typeid),-1,3)=substr(rtrim(p_TypeID),-1,3); --此节点的所有孩子 delete from type_tree where instr(parentid,NewTypeID)>0 and substr(rtrim(Parentid),-1,3)=substr(rtrim(p_TypeID),-1,3); --此节点 delete from type_tree where typeid=p_typeid; commit; dbms_output.put_line('删除成功'); exception where others then rollback; dbms_output.put_line('删除失败'); end; end; /
as
NewTypeID varchar(30);
OldTypeID varchar(30);
begin
begin
NewTypeID:=substr(p_typeid,1,Level*3);
--资源匹配信息
delete from res_type where instr(typeid,NewTypeID)>0 and substr(rtrim(typeid),-1,3)=substr(rtrim(p_TypeID),-1,3);
--权限信息
delete from grouppermission where instr(typeid,NewTypeID)>0 and substr(rtrim(typeid),-1,3)=substr(rtrim(p_TypeID),-1,3);
--此节点的所有孩子
delete from type_tree where instr(parentid,NewTypeID)>0 and substr(rtrim(Parentid),-1,3)=substr(rtrim(p_TypeID),-1,3);
--此节点
delete from type_tree where typeid=p_typeid;
commit;
dbms_output.put_line('删除成功');
exception
where others then
rollback;
dbms_output.put_line('删除失败');
end;
end;
/
as
NewTypeID varchar(30);
OldTypeID varchar(30);
begin
begin
NewTypeID:=substr(p_typeid,1,Level*3);
--资源匹配信息
delete from res_type where instr(typeid,NewTypeID)>0 and substr(rtrim(typeid),-1,3)=substr(rtrim(p_TypeID),-1,3);
--权限信息
delete from grouppermission where instr(typeid,NewTypeID)>0 and substr(rtrim(typeid),-1,3)=substr(rtrim(p_TypeID),-1,3);
--此节点的所有孩子
delete from type_tree where instr(parentid,NewTypeID)>0 and substr(rtrim(Parentid),-1,3)=substr(rtrim(p_TypeID),-1,3);
--此节点
delete from type_tree where typeid=p_typeid;
commit;
dbms_output.put_line('删除成功');
exception
where others then
rollback;
dbms_output.put_line('删除失败');
end;
end;
/