Re: Returnd Refcurser (<unnamed portal x> not fetchable

From: "Penchalaiah P(dot)" <penchalaiahp(at)infics(dot)com>
To: "Christian Kindler" <christian(dot)kindler(at)gmx(dot)net>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Returnd Refcurser (<unnamed portal x> not fetchable
Date: 2007-08-10 06:05:20
Message-ID: A70AE049E81A6A40879D5DC0AC8C38C9099EA08F@venus.infics.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


create table foo(sirname text, name text); insert into foo values
('Mueller', 'Marcus');

create function getfoo(char(1)) returns refcursor as '
declare
ref refcursor;

begin
open ref for select * from foo where sirname like ''%'' || $1 ||
''%'';
return next ref;
return
end;
'
LANGUAGE 'plpgsql' VOLATILE;

Copy the above function and execute..i changed at return statement.....

Thanks & Regards
Penchal Reddy

-----Original Message-----
From: pgsql-sql-owner(at)postgresql(dot)org
[mailto:pgsql-sql-owner(at)postgresql(dot)org] On Behalf Of Christian Kindler
Sent: Friday, August 10, 2007 11:28 AM
To: pgsql-sql(at)postgresql(dot)org
Subject: [SQL] Returnd Refcurser (<unnamed portal x> not fetchable

Hi!

I have the Problem, that a function returns a refcursor and I am not
able to fetch them. I tried in several ways.

Can you please tell me how to get the cursor data.

Thanks
Chris

PS this is what I have:

create table foo(sirname text, name text);
insert into foo values ('Mueller', 'Marcus');

create function getfoo(char(1)) returns refcursor as
'
declare
ref refcursor;

begin
open ref for select * from foo where sirname like ''%'' || $1 ||
''%'';
return ref;
end;
'
LANGUAGE 'plpgsql' VOLATILE;

select * from getfoo('M');
* fetch all in '<unnamed portal 11>';

ERROR: syntax error at or near "'<unnamed portal 11>'" at character 14

--
cu
Chris

GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Information transmitted by this e-mail is proprietary to Infinite Computer Solutions and / or its Customers and is intended for use only by the individual or the entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at info(dot)in(at)infics(dot)com and delete this email from your records.

Browse pgsql-sql by date

  From Date Subject
Next Message Christian Kindler 2007-08-10 06:16:28 Re: Returnd Refcurser (<unnamed portal x> not fetchable
Previous Message Christian Kindler 2007-08-10 05:57:46 Returnd Refcurser (<unnamed portal x> not fetchable