create or replace function fn_getbelongsCodeByCategory01(p_eventcategory in varchar2)
return varchar2 is
begin
declare
L_tmp varchar2(32766);
L_Result varchar2(32766);
--定义游标
cursor cur is
select t.innercode
from vw_commontype t
start with id = p_eventcategory
connect by prior id = parentid
group by t.innercode;
begin
--遍历游标
FOR tab IN cur
loop --遍历
L_tmp := tab.innercode;
if (L_tmp is not null and L_Result is null) then
L_Result := '''' || L_tmp||'''';
else
L_Result := L_Result||',''' || L_tmp||'''';
end if;
end loop;
return L_Result;
--异常处理
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN NULL;
end;
end;
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。