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

时间:2014-09-12 18:47:53   收藏:0   阅读:633

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;

原文:http://www.cnblogs.com/yshj/p/3968804.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!