Re: Getting Out Parameter in the application using libpq

Поиск
Список
Период
Сортировка
От Ehsan Haq
Тема Re: Getting Out Parameter in the application using libpq
Дата
Msg-id 578020.55402.qm@web31812.mail.mud.yahoo.com
обсуждение исходный текст
Ответ на Re: Getting Out Parameter in the application using libpq  (Merlin Moncure <mmoncure@gmail.com>)
Ответы Re: Getting Out Parameter in the application using libpq  (Merlin Moncure <mmoncure@gmail.com>)
Re: Getting Out Parameter in the application using libpq  ("Albe Laurenz" <laurenz.albe@wien.gv.at>)
Список pgsql-general
Hi,
   I still don't get. How can I get the varchar OUT parameter in the application? For Example

CREATE OR REPLACE
Function getOutVarchar(outvarchar OUT varchar2) RETURN NUMBER
IS
BEGIN
   outvarchar:='This is Out String';
   RETURN 1;
END getOutVarchar;

iris=> SELECT getOutVarchar('outVar');
 getoutvarchar
---------------
             1
(1 row)

My question is how can I Select "outVar" so that it is available in my application as a resultset.

Thanks
Ehsan


--- On Fri, 9/11/09, Merlin Moncure <mmoncure@gmail.com> wrote:

From: Merlin Moncure <mmoncure@gmail.com>
Subject: Re: [GENERAL] Getting Out Parameter in the application using libpq
To: "Ehsan Haq" <ehsan_haq98@yahoo.com>
Cc: pgsql-general@postgresql.org
Date: Friday, September 11, 2009, 12:08 PM

On Fri, Sep 11, 2009 at 12:31 AM, Ehsan Haq <ehsan_haq98@yahoo.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

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

В списке pgsql-general по дате отправления:

Предыдущее
От: "Vikram Patil"
Дата:
Сообщение: Issue regarding permissions on Windows 2003 server
Следующее
От: "Vikram Patil"
Дата:
Сообщение: Regarding initdb & pg_ctl