日期:2014-05-16  浏览次数:20429 次

取出角色关联的菜单ids("#_拼接")
create or replace function njutec_getMenuIds(trdids in varchar2) return varchar2 is
  Result varchar2(4000);
  v_acc_nbr varchar2(400);
  type ref_cursor is ref cursor;
  menu_id ref_cursor;
begin
  Result:='';
  open menu_id for
  select t.menuid from PLT_MENU_ROL t
  where t.trdid =trdids;
  loop
    fetch menu_id into v_acc_nbr;
        exit when menu_id%notfound;
        --if(tempCount>8) then
        --       goto label_end;
        --end if;
       Result:=Result||'#_'||(v_acc_nbr);
  end loop;
  --<<label_end>>
  close menu_id;
  Result:=substr(Result,3,length(Result));
  return(Result);
  exception when others then
      if(menu_id%isopen) then
        close menu_id;
      end if;
  return '';
end njutec_getMenuIds;