Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 3DA249FA186 for ; Fri, 10 Aug 2007 03:05:32 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 30408-01-4 for ; Fri, 10 Aug 2007 03:05:24 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from gateway.infics.com (gateway.infics.com [202.54.39.20]) by postgresql.org (Postfix) with ESMTP id AF4D69FB22A for ; Fri, 10 Aug 2007 03:05:25 -0300 (ADT) X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Re: Returnd Refcurser ( not fetchable Date: Fri, 10 Aug 2007 11:35:20 +0530 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SQL] Returnd Refcurser ( not fetchable Thread-Index: AcfbE9Sd6+nan3+7TYy8gBBnGjfa7wAAGMZw From: "Penchalaiah P." To: "Christian Kindler" , X-imss-version: 2.047 X-imss-result: Passed X-imss-scanInfo: M:B L:E SM:3 X-imss-tmaseResult: TT:1 TS:-0.7927 TC:1F TRN:34 TV:3.6.1039(15352.002) X-imss-scores: Clean:73.83325 C:2 M:3 S:5 R:5 X-imss-settings: Baseline:3 C:4 M:4 S:4 R:4 (0.5000 0.5000) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/70 X-Sequence-Number: 29008 create table foo(sirname text, name text); insert into foo values ('Mueller', 'Marcus'); create function getfoo(char(1)) returns refcursor as ' declare=0D ref refcursor; begin open ref for select * from foo where sirname like ''%'' || $1 || ''%''; return next ref; return=0D end; =0D ' 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 ( 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.=0D Can you please tell me how to get the cursor data. Thanks=0D 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=0D ref refcursor; begin open ref for select * from foo where sirname like ''%'' || $1 || ''%''; return ref; end; =0D ' LANGUAGE 'plpgsql' VOLATILE; select * from getfoo('M'); * fetch all in ''; ERROR: syntax error at or near "''" at character 14 --=0D 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.