On Wed, 09 Dec 2009 23:22:13 +0000, Mladen Gogala wrote:
Quote:
Does anybody have an example with spi_prepare, spi_exec_prepared or
spi_query_prepared? I managed to get the basic concepts: |
This is no longer an issue. I figured it out:
create function test_pl(varchar) returns setof varchar as $$
my ($job)=@_;
my $qry='select ename from emp where job=$1';
my $sth=spi_prepare($qry,'varchar');
my $rs=spi_query_prepared($sth,$job);
while (my $row=spi_fetchrow($rs)) {
last unless defined($row);
return_next($row->{ename});
}
return(undef);
$$ language plperl;
--
http://mgogala.byethost5.com