Hi,
I am writing an function which takes an ip integer matches it with table columns functions and gives out the records;

create table customer(customerid int,resellerid int);

insert into customer values (156,1);
insert into customer values (157,1);
insert into customer values (158,1);
insert into customer values (159,1);


create or replace function f_c(text) returns record as '
declare ip alias for $1;rec record;
begin
for rec in execute ''select customerid,resellerid from customer where customerid in ('' || ip || '')''
loop
return rec;
end loop;
end;' language plpgsql;


This works fine when i execute the command :-

select * from f_c('157') as (c int,r int);

but when i execute the below function to get a set of records then:-

create or replace function f_c(text) returns setof record as '
declare ip alias for $1;rec record;
begin
for rec in execute ''select customerid,resellerid from customer where customerid in ('' || ip || '')''
loop
return rec;
end loop;
end;' language plpgsql;

select * from f_c('157,156') as (c int,r int);

Then it doesn't return any value, even though it doesn't give any errors.

Thanks for any help in advance.