Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 4D1746382C7 for ; Tue, 14 Jul 2009 13:18:38 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 75361-04-6 for ; Tue, 14 Jul 2009 13:18:26 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp.virtusa.com (smtp.virtusa.com [12.40.51.197]) by mail.postgresql.org (Postfix) with ESMTP id E5A6563FD3D for ; Tue, 14 Jul 2009 12:18:23 -0300 (ADT) X-TM-IMSS-Message-ID: <225475f200001314@smtp.virtusa.com> Received: from ws-mailsvr.Virtusa.com (ws-mailsvr.virtusa.com [10.3.8.4]) by smtp.virtusa.com ([172.16.1.6]) with ESMTP (TREND IMSS SMTP Service 7.0) id 225475f200001314 ; Tue, 14 Jul 2009 11:18:40 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: function returning a cursor and a scalar Date: Tue, 14 Jul 2009 11:21:37 -0400 Message-ID: <75F63F40B35C3144854E90019EB086770DDC05D7@ws-mailsvr.Virtusa.com> In-Reply-To: <20090713182130.GG4930@alvh.no-ip.org> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SQL] function returning a cursor and a scalar Thread-Index: AcoD5uzBVM16aFtXSfe+AABOgR9QTQArwawQ References: <75F63F40B35C3144854E90019EB086770DDC0229@ws-mailsvr.Virtusa.com> <20090713182130.GG4930@alvh.no-ip.org> From: "Surajit Bhattacharjee" To: "Alvaro Herrera" Cc: X-TM-AS-Product-Ver: IMSS-7.0.0.6298-5.6.0.1016-16764.000 X-TM-AS-Result: No--6.431-5.0-31-1 X-imss-scan-details: No--6.431-5.0-31-1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=0 required=5 tests=AWL=0.001 X-Spam-Level: X-Archive-Number: 200907/68 X-Sequence-Number: 32809 Thanks=20much=20Alvaro.=20Didn't=20know=20I=20could=20do=20that. For=20returning=20the=20matches,=20I=20am=20planning=20to=20run=20a=20sep= arate=20count(*) query=20with=20the=20original=20WHERE=20clause=20minus=20joins=20that=20a= re=20purely=20for pulling=20addnl=20attributes=20from=20related=20entities.=20Only=20if=20t= his=20query returns=20a=20positive=20count,=20I=20will=20run=20the=20query=20that=20a= ctually=20gets=20the data.=20I=20google'd=20some=20and=20couldn't=20find=20a=20way=20to=20avoi= d=20two=20queries. Best=20Regards, Surajit=20Bhattacharjee __________________ Mobile:=20508-277-9091 VOIP:=209032 -----Original=20Message----- From:=20Alvaro=20Herrera=20[mailto:alvherre@commandprompt.com]=20 Sent:=20Monday,=20July=2013,=202009=202:22=20PM To:=20Surajit=20Bhattacharjee Cc:=20pgsql-sql@postgresql.org Subject:=20Re:=20[SQL]=20function=20returning=20a=20cursor=20and=20a=20sc= alar Surajit=20Bhattacharjee=20wrote: >=20I=20am=20new=20to=20Postgresql=20and=20am=20trying=20to=20write=20a= =20function=20which=20will=20do a >=20search=20and=20return=20the=20first=20page=20of=20results=20along=20w= ith=20the=20total number >=20of=20matches.=20How=20can=20I=20make=20my=20function=20return=20a=20c= ursor=20AND=20a=20scalar=20- >=20can=20I=20do=20the=20scalar=20as=20an=20OUT=20param=20and=20then=20ma= ke=20the=20function >=20explicitly=20RETURN=20a=20refcursor? Why=20wouldn't=20you=20just=20use=20two=20OUT=20params? BTW=20how=20do=20you=20plan=20on=20returning=20the=20number=20of=20matche= s? --=20 Alvaro=20Herrera http://www.CommandPrompt.com/ PostgreSQL=20Replication,=20Consulting,=20Custom=20Development,=2024x7=20= support -------------------------------------------------------------------------= -------------------- This=20message,=20including=20any=20attachments,=20contains=20confidentia= l=20information=20intended=20for=20a=20specific=20individual=20and=20purp= ose,=20and=20is=20intended=20for=20the=20addressee=20only.=20Any=20unauth= orized=20disclosure,=20use,=20dissemination,=20copying,=20or=20distributi= on=20of=20this=20message=20or=20any=20of=20its=20attachments=20or=20the= =20information=20contained=20in=20this=20e-mail,=20or=20the=20taking=20of= =20any=20action=20based=20on=20it,=20is=20strictly=20prohibited.=20If=20y= ou=20are=20not=20the=20intended=20recipient,=20please=20notify=20the=20se= nder=20immediately=20by=20return=20e-mail=20and=20delete=20this=20message= . -------------------------------------------------------------------------= --------------------