Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Rows to a List
Barbara Boehmer schrieb:
> 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;
>
It's not much, but use return substr(res, 2) should be a little bit
faster even. the ',' at the beginning of res must be there if res is not
null, so why test for it.
May only be important if used *very* often. Received on Wed Aug 03 2005 - 15:50:02 CDT
![]() |
![]() |