create or replace function jwzh.myconcat(zzbh in varchar2) return varchar2 is sszrq varchar2(2000); begin select to_char(wm_concat(hjzrq)) into sszrq from (select t.hjzrq from ry_jbxx t, ry_hcy r where t.rybh = r.rybh and r.ryzt = 0 and t.hjzrq is not null and r.hzzbh is not null and r.hzzbh = zzbh group by t.hjzrq); return sszrq; exception when others then sszrq := null; return sszrq; end;
sszrq varchar2(2000);
begin
select to_char(wm_concat(hjzrq))
into sszrq
from (select t.hjzrq
from ry_jbxx t, ry_hcy r
where t.rybh = r.rybh
and r.ryzt = 0
and t.hjzrq is not null
and r.hzzbh is not null
and r.hzzbh = zzbh
group by t.hjzrq); return sszrq;
exception
when others then
sszrq := null;
return sszrq;
end;
有这个原因,还有SQL赋值用SELECT INTO
并且,你的wm_concat并不一定返回的是varchar2,有的版本是clob.
WM_CONCAT是undocument function不应该在正式环境下使用的,undocument function一般是oracle内部功能自己用的,你直接用他的会有很多问题,比如你这个版本更替,完全可以自己写个。