Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Rows to a List
Checking and setting the value of first within each iteration of the
loop may be slowing things down. You could just trim the extra comma
after the loop:
create or replace function list ( field1 number ) return varchar2 as
res varchar2(2000) := null;
begin
for curs in
(select fldz from tbl_y where num=field1 order by fldz) loop
res := res || ',' || curs.fldz;
end loop;
return ltrim (res, ',');
end list;
Received on Wed Aug 03 2005 - 15:05:48 CDT