pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedReturnd Refcurser (<unnamed portal x> not fetchable
6+ messages / 4 participants
[nested] [flat]
* Returnd Refcurser (<unnamed portal x> not fetchable
@ 2007-08-10 05:57 Christian Kindler <christian.kindler@gmx.net>
0 siblings, 0 replies; 6+ messages in thread
From: Christian Kindler @ 2007-08-10 05:57 UTC (permalink / raw)
To: pgsql-sql
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
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Returnd Refcurser (<unnamed portal x> not fetchable
@ 2007-08-10 06:05 Penchalaiah P. <penchalaiahp@infics.com>
0 siblings, 0 replies; 6+ messages in thread
From: Penchalaiah P. @ 2007-08-10 06:05 UTC (permalink / raw)
To: Christian Kindler <christian.kindler@gmx.net>; 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@postgresql.org
[mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Christian Kindler
Sent: Friday, August 10, 2007 11:28 AM
To: pgsql-sql@postgresql.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.in@infics.com and delete this email from your records.
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Returnd Refcurser (<unnamed portal x> not fetchable
@ 2007-08-10 06:16 Christian Kindler <christian.kindler@gmx.net>
2007-08-10 06:26 ` Re: Returnd Refcurser (<unnamed portal x> not fetchable Tom Lane <tgl@sss.pgh.pa.us>
2007-08-10 06:31 ` Re: Returnd Refcurser (<unnamed portal x> not fetchable Michael Fuhr <mike@fuhr.org>
0 siblings, 2 replies; 6+ messages in thread
From: Christian Kindler @ 2007-08-10 06:16 UTC (permalink / raw)
To: Penchalaiah P. <penchalaiahp@infics.com>; pgsql-sql
Sorry but this didn't help ...
Can not return next ... so I changed the returns as too but same effect as the first function:
drop table foo;
create table foo(sirname text, name text);
insert into foo values ('Mueller', 'Marcus');
drop function getfoo(char(1));
create or replace function getfoo(char(1)) returns setof refcursor as
'
declare
ref refcursor;
begin
open ref for select * from foo where sirname like ''%'' || $1 || ''%'';
return next ref;
end;
'
LANGUAGE 'plpgsql' VOLATILE;
select * from getfoo('M');
-- fetch all in '<unnamed portal 14>';
ERROR: syntax error at or near "'<unnamed portal 14>'" at character 15
--
cu
Chris
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kanns mit allen: http://www.gmx.net/de/go/multimessenger
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Returnd Refcurser (<unnamed portal x> not fetchable
2007-08-10 06:16 Re: Returnd Refcurser (<unnamed portal x> not fetchable Christian Kindler <christian.kindler@gmx.net>
@ 2007-08-10 06:26 ` Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 0 replies; 6+ messages in thread
From: Tom Lane @ 2007-08-10 06:26 UTC (permalink / raw)
To: Christian Kindler <christian.kindler@gmx.net>; +Cc: Penchalaiah P. <penchalaiahp@infics.com>; pgsql-sql
"Christian Kindler" <christian.kindler@gmx.net> writes:
> fetch all in '<unnamed portal 14>';
> ERROR: syntax error at or near "'<unnamed portal 14>'" at character 15
I think you need double quotes not single quotes here.
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Returnd Refcurser (<unnamed portal x> not fetchable
2007-08-10 06:16 Re: Returnd Refcurser (<unnamed portal x> not fetchable Christian Kindler <christian.kindler@gmx.net>
@ 2007-08-10 06:31 ` Michael Fuhr <mike@fuhr.org>
2007-08-10 06:35 ` Re: Returnd Refcurser (<unnamed portal x> not fetchable Christian Kindler <christian.kindler@gmx.net>
1 sibling, 1 reply; 6+ messages in thread
From: Michael Fuhr @ 2007-08-10 06:31 UTC (permalink / raw)
To: Christian Kindler <christian.kindler@gmx.net>; +Cc: Penchalaiah P. <penchalaiahp@infics.com>; pgsql-sql
On Fri, Aug 10, 2007 at 08:16:28AM +0200, Christian Kindler wrote:
> select * from getfoo('M');
> -- fetch all in '<unnamed portal 14>';
>
> ERROR: syntax error at or near "'<unnamed portal 14>'" at character 15
The cursor name is an identifier so use double quotes instead of
single quotes. Also, when using non-holdable cursors you'll need
to be in a transaction block.
begin;
select * from getfoo('M');
fetch all in "<unnamed portal 14>";
commit;
--
Michael Fuhr
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: Returnd Refcurser (<unnamed portal x> not fetchable
2007-08-10 06:16 Re: Returnd Refcurser (<unnamed portal x> not fetchable Christian Kindler <christian.kindler@gmx.net>
2007-08-10 06:31 ` Re: Returnd Refcurser (<unnamed portal x> not fetchable Michael Fuhr <mike@fuhr.org>
@ 2007-08-10 06:35 ` Christian Kindler <christian.kindler@gmx.net>
0 siblings, 0 replies; 6+ messages in thread
From: Christian Kindler @ 2007-08-10 06:35 UTC (permalink / raw)
To: Michael Fuhr <mike@fuhr.org>; +Cc: pgsql-sql; penchalaiahp@infics.com
Ohhh Yes!
Thanks al lot. Sometimes you can't see the wood for the trees.
Thanks!
Chris
-------- Original-Nachricht --------
Datum: Fri, 10 Aug 2007 00:31:03 -0600
Von: Michael Fuhr <mike@fuhr.org>
An: Christian Kindler <christian.kindler@gmx.net>
CC: "Penchalaiah P." <penchalaiahp@infics.com>, pgsql-sql@postgresql.org
Betreff: Re: [SQL] Returnd Refcurser (<unnamed portal x> not fetchable
> On Fri, Aug 10, 2007 at 08:16:28AM +0200, Christian Kindler wrote:
> > select * from getfoo('M');
> > -- fetch all in '<unnamed portal 14>';
> >
> > ERROR: syntax error at or near "'<unnamed portal 14>'" at character 15
>
> The cursor name is an identifier so use double quotes instead of
> single quotes. Also, when using non-holdable cursors you'll need
> to be in a transaction block.
>
> begin;
> select * from getfoo('M');
> fetch all in "<unnamed portal 14>";
> commit;
>
> --
> Michael Fuhr
--
cu
Chris
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2007-08-10 06:35 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-08-10 05:57 Returnd Refcurser (<unnamed portal x> not fetchable Christian Kindler <christian.kindler@gmx.net>
2007-08-10 06:05 Re: Returnd Refcurser (<unnamed portal x> not fetchable Penchalaiah P. <penchalaiahp@infics.com>
2007-08-10 06:16 Re: Returnd Refcurser (<unnamed portal x> not fetchable Christian Kindler <christian.kindler@gmx.net>
2007-08-10 06:26 ` Tom Lane <tgl@sss.pgh.pa.us>
2007-08-10 06:31 ` Michael Fuhr <mike@fuhr.org>
2007-08-10 06:35 ` Christian Kindler <christian.kindler@gmx.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox