丁俊大哥,不明白你说的存储过程将类型改为CLOB,你的意思是改f_str2list里面的参数类型吗,这个我已经改了,但还是哪个问题,我把我的调用函数的SQL直接贴出来吧,你帮我看看。。。。。%>_
with t1 as (
select distinct cuid,label_cn,location_city,system_sysservices from a
union
select distinct cuid,label_cn,location_city,system_sysservices from b
union
select distinct cuid,label_cn,location_city,system_sysservices from c
)
,t2 as (
select a.cuid,a.if_desc,t1.location_city,t1.system_sysservices
from 端口 a,t1
where a.related_dev = t1.cuid
)
select to_char(b.org_time,'yyyy-mm-dd') org_time,t2.cuid,t2.if_desc,t2.location_city,
t2.system_sysservices,b.ifspeed,b.avgifinoctets_speed,
b.AVGIFINBandwidth_RATE,b.AVGIFOUTOCTETS_SPEED,b.AVGIFOutBandwidth_RATE,b.MAXIFINOCTETS_SPEED,
b.MAXIFINBandwidth_RATE,b.MAXIFOUTOCTETS_SPEED,b.MAXIFOutBandwidth_RATE
from t2,RPT_NETWORK_INTERFACE_DAY b,table(cast(f_str2list(to_clob(?)) as t_str2list)) d -- 函数的调用,问号代表哪个字符串
where replace(t2.cuid,':','#') = b.object_key
and b.ORG_TIME >= to_date(?,'yyyy-mm-dd')
and b.ORG_TIME
and t2.cuid = d.column_value
order by to_char(b.org_time,'yyyy-mm-dd') ASC,t2.cuid,t2.if_desc
函数:f_str2list
CREATE OR REPLACE function f_str2list (v_str in clob) return t_str2list
as
vv_str clob default v_str || ',' ;
v_count number;
v_t_str2list t_str2list := t_str2list();
begin
loop
v_count := instr(vv_str,',');
exit when (nvl(v_count,0) = 0);
v_t_str2list.extend;
v_t_str2list(v_t_str2list.count) := ltrim(rtrim(substr(vv_str,1,v_count-1)));
vv_str := substr(vv_str,v_count+1);
end loop;
return v_t_str2list;
end;
/