create or replace function str_list( str_in in varchar2 )
--分类字段
return varchar2 is
str_list varchar2(4000) default null;
--连接后字符串
str varchar2(20) default null;
--连接符号
begin
for x in ( select TEST.CITY from TEST
where TEST.COUNTRY = str_in ) loop
str_list := str_list || str || to_char(x.city);
str := ',';
end loop;
return str_list;
end;
--分类字段
return varchar2 is
str_list varchar2(4000) default null;
--连接后字符串
str varchar2(20) default null;
--连接符号
begin
for x in ( select TEST.CITY from TEST
where TEST.COUNTRY = str_in ) loop
str_list := str_list || str || to_char(x.city);
str := ',';
end loop;
return str_list;
end;