Re: Getting Out Parameter in the application using libpq

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Ehsan Haq <ehsan_haq98(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Getting Out Parameter in the application using libpq
Date: 2009-09-11 12:08:35
Message-ID: b42b73150909110508o40876eackbc4a4246d97b7e82@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Sep 11, 2009 at 12:31 AM, Ehsan Haq <ehsan_haq98(at)yahoo(dot)com> wrote:
>
> Hi,
>    I am looking for a way to get the OUT parameters of a FUNCTION/PROCEDURE in my application (C++) using C libpq library. I can get the result set of an OUT parameter having REFCURSOR data type through an explicit FETCH ALL from "YYYY" but for OUT parameter of type integer/varchar I dont have a clue. Can anyone tell me how it is done or suggest any work around for this?

name your cursor: also, remember that your cursor is only good for
duration of transaction.

> Using the following code I can get the refcursor.
>
> CREATE OR REPLACE
> Function getAddresses
> (
> pName IN varchar2, outCursor refcursor

outCursor := 'outcur';

[...]

FETCH all FROM outcur;

see:
http://www.postgresql.org/docs/8.4/interactive/plpgsql-cursors.html#PLPGSQL-CURSOR-USING

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message erik 2009-09-11 12:24:12 8.3.7 server fails to start on Snow Leopard 10.6.1
Previous Message Psicopunk 2009-09-11 10:01:29 Postgresql Hardware