If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

No, you'll have to do a lot more than filter it. The string concatenation via PL/SQL is a good way to accomplish this. Doing a select whatever||whatever from where_ever deals with one record at a time; hence, the useless results as shown below.

select my_section,all_text from
(
select
my_section,
my_piece,
my_text||
lead(my_text,1) over (partition by my_section order by my_piece)||
lead(my_text,2) over (partition by my_section order by my_piece)||
lead(my_text,3) over (partition by my_section order by my_piece)||
lead(my_text,4) over (partition by my_section order by my_piece)||
lead(my_text,5) over (partition by my_section order by my_piece)||
lead(my_text,6) over (partition by my_section order by my_piece)||
lead(my_text,7) over (partition by my_section order by my_piece) all_text,
first_value(my_piece) over(partition by my_section) first_piece
from
my_table
)
where my_piece = first_piece
/

create or replace type AggratinateImpl as object
(
concat_string varchar2(4000),
static function ODCIAggregateInitialize(sctx in out AggratinateImpl) return number,
member function ODCIAggregateIterate(self in out AggratinateImpl, value in varchar2) return number,
member function ODCIAggregateTerminate(self in AggratinateImpl, returnValue out varchar2,flags in number) return number,
member function ODCIAggregateMerge(self in out AggratinateImpl,ctx2 in AggratinateImpl) return number
);