原来的保存function
create or replace function get_area_path_name(areaId in number) return varchar2 is pathName varchar2(1000); begin select replace(to_char(wm_concat(pathname) ),',','/') into pathName from (select rs.name as pathname from rs_area rs start with rs.id=areaId connect by rs.id = prior rs.parent_id order by rs.area_type_id ); return pathName; exception when others then return ''; end get_area_path_name;
修改后:
create or replace function get_area_path_name(areaId in number) return varchar2 is pathName varchar2(1000); begin select replace(to_char(LISTAGG(pathname, ',') within group(order by pathname)), ',', '/') into pathName from (select rs.name as pathname from rs_area rs start with rs.id = areaId connect by rs.id = prior rs.parent_id order by rs.area_type_id); return pathName; exception when others then return ''; end get_area_path_name;