create or replace function get_col(p_id in varchar2)
return varchar2
as
resut varchar2(50);
cursor t_sor is
select col_name from table_name where id=p_id;
begin
for v_sor in t_sor loop
resut:=resut||v_sor.col_name;
end loop;
return resut;
end;
/select id,get_col(id) from table_name group by id;