Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 7F8D8475CCE for ; Thu, 12 Sep 2002 14:10:28 -0400 (EDT) Received: from hotmail.com (dav37.law15.hotmail.com [64.4.22.94]) by postgresql.org (Postfix) with ESMTP id B94A4475BEC for ; Thu, 12 Sep 2002 14:10:27 -0400 (EDT) Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 12 Sep 2002 11:10:27 -0700 X-Originating-IP: [204.244.28.188] From: "david williams" To: Subject: Returning a reference to a cursor from a function Date: Thu, 12 Sep 2002 14:12:37 -0400 MIME-Version: 1.0 X-Mailer: MSN Explorer 7.00.0021.1900 Content-Type: multipart/alternative; boundary="----=_NextPart_001_0002_01C25A66.729533E0" Message-ID: X-OriginalArrivalTime: 12 Sep 2002 18:10:27.0951 (UTC) FILETIME=[AC6A07F0:01C25A87] X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200209/163 X-Sequence-Number: 9440 ------=_NextPart_001_0002_01C25A66.729533E0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To anyone who can help me, I am new at Postgresql and am having some problems. I am trying to return a rowset from a function to the calling procedure. Outside a function I have gotten this to work at the psql level. ------------- BEGIN Work; DECLARE Liahona CURSOR FOR Select * from users; FETCH FORWARD ALL IN Liahona; CLOSE Liahona; COMMIT Work; -------------- I went a stage further attempt to put this query into a function as such -------------- CREATE FUNCTION getallusers() RETURN integer AS' DECLARE Liahona CURSOR FOR Select * from users; BEGIN FETCH FORWARD ALL IN Liahona; CLOSE Liahona; END; 'language 'plpgsql'; --------------- Followed by 'select getallusers();' for testing purposes. I get the error: ERROR during compile of getallusers near line 5 Parse error at or near "FORWARD" I have tried creating RECORD type cursors but no luck. Can anyone suggest how to do this. I was referenced to this this through my discussion at dbforums.com. http://dbforums.com/t499825.html Thanks !-------------------------------------! David WilliamsGet more from the Web. FREE MSN Explorer download : http://e= xplorer.msn.com ------=_NextPart_001_0002_01C25A66.729533E0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
To anyone who ca= n help me,
 
I am new at Postgresql and am havin= g some problems.
 
I am trying to return a rowse= t from a function to the calling procedure.
 
Ou= tside a function I have gotten this to work at the psql level.
&= nbsp;
-------------
BEGIN Work;
 = ;   DECLARE Liahona CURSOR FOR Select * from users;
FE= TCH FORWARD ALL IN Liahona;
CLOSE Liahona;
COMMIT Wor= k;
--------------
 
I went a stage fu= rther attempt to put this query into a function as such
 
--------------
CREATE FUNCTION getallusers() RETURN in= teger AS'
DECLARE
    Liahona CURSOR F= OR Select * from users;
BEGIN
 
FETCH= FORWARD ALL IN Liahona;
 
CLOSE Liahona;
=
END;
'language 'plpgsql';
 
----= -----------
Followed by 'select getallusers();' for testing purp= oses.
 
I get the error:
 
=
ERROR during compile of getallusers near line 5
Parse erro= r at or near "FORWARD"
 
I have tried creating R= ECORD type cursors but no luck.
 
Can anyone sug= gest how to do this.
 
I was referenced to this = this through my discussion at dbforums.com.
 
http://dbforums.com/t499825.html=
Thanks

!--------------------------------= -----!
David Williams


Get more fr= om the Web. FREE MSN Explorer download : http://explorer.msn.com

------=_NextPart_001_0002_01C25A66.729533E0--