Re: Getting Out Parameter in the application using libpq

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

Hi,
   First of all the below mentioned function can't be called with "SELECT * FROM getOutVarchar()". Since the Function signature does not match.
CREATE OR REPLACE
Function getOutVarchar(outvarchar OUT varchar2) RETURN NUMBER
IS
BEGIN
   outvarchar:='This is Out String';
   RETURN 1;
END getOutVarchar;
However calling the above function with "SELECT * FROM getOutVarchar('abc');" does returns a Single column in a single row with a field named 'outvarchar' but the value of the field is "1" which is obvious due to "RETURN 1" and not "This is Out String".

Thanks
Ehsan

--- On Sat, 9/12/09, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
Subject: Re: [GENERAL] Getting Out Parameter in the application using libpq
To: "Ehsan Haq" <ehsan_haq98(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Date: Saturday, September 12, 2009, 1:21 PM

On Fri, Sep 11, 2009 at 10:30 PM, Ehsan Haq <ehsan_haq98(at)yahoo(dot)com> wrote:
>
> 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

if, from libpq:

res = PQexec(conn, "SELECT * FROM getOutVarchar()");

the result should have a one column, one row result with a field
called outvarchar.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message raghu ram 2009-09-13 08:23:01 Invitation to connect on LinkedIn
Previous Message Clodoaldo Neto 2009-09-13 00:34:09 Re: Missing 8.2.14 source rpms