Oracle多行转单行
create or replace type vars is table of varchar2(10000);
create or replace function sumvarc (p_in in vars) return clob
is
v_out clob;
begin
for i in 1..p_in.count loop-
v_out := v_out || p_in(i);
end loop;
return v_out;
end;
--用法
select user_name,
sumvar(cast(multiset(select ','||function_name
from user_funciotn
where a.user_name=user_name
order by function_name) as vars
)
) as aggr
from user_funciotn
本文出自:亿恩科技【www.enkj.com】
服务器租用/服务器托管中国五强!虚拟主机域名注册顶级提供商!15年品质保障!--亿恩科技[ENKJ.COM]
|