您的位置:首页 > 博客中心 > 数据库 >

Oracle循环查询结果集 自定义函数

时间:2022-03-13 23:43

create or replace function Fun_GetRoleIDList(d_fid char) return varchar is
  rolelist varchar(2000);
begin
  rolelist := ‘‘;
  ---定义游标
 declare cursor role_cur is select a.roleid from u_roleinfo a , u_node_roles b  where  a.roleid=b.roleid and b.fid=d_fid ;
 
  begin
    ---循环
    for roles in role_cur loop
      rolelist := rolelist || roles.roleid || ‘,‘;---赋值
    end loop;
   
  end;
  return(rolelist);---返回
end Fun_GetRoleIDList;

热门排行

今日推荐

热门手游