pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@commandprompt.com>
To: Surajit Bhattacharjee <surajitb@virtusa.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: function returning a cursor and a scalar
Date: Mon, 13 Jul 2009 14:21:30 -0400
Message-ID: <20090713182130.GG4930@alvh.no-ip.org> (raw)
In-Reply-To: <75F63F40B35C3144854E90019EB086770DDC0229@ws-mailsvr.Virtusa.com>
References: <75F63F40B35C3144854E90019EB086770DDC0229@ws-mailsvr.Virtusa.com>

Surajit Bhattacharjee wrote:
> I am new to Postgresql and am trying to write a function which will do a
> search and return the first page of results along with the total number
> of matches. How can I make my function return a cursor AND a scalar -
> can I do the scalar as an OUT param and then make the function
> explicitly RETURN a refcursor?

Why wouldn't you just use two OUT params?

BTW how do you plan on returning the number of matches?

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support



view thread (3+ messages)  latest in thread

Message-ID: <20090713182130.GG4930@alvh.no-ip.org>
Permalink:  ../20090713182130.GG4930@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20090713182130.GG4930@alvh.no-ip.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: alvherre@commandprompt.com, surajitb@virtusa.com
  Subject: Re: function returning a cursor and a scalar
  In-Reply-To: <20090713182130.GG4930@alvh.no-ip.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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