Re: CRecordset::Open postgresql procedure call don't work

From: John McKown <john(dot)archie(dot)mckown(at)gmail(dot)com>
To: jeanclaude marzin <jeanclaude(dot)marzin(at)sfr(dot)fr>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: CRecordset::Open postgresql procedure call don't work
Date: 2019-07-15 11:57:31
Message-ID: CAAJSdji1EnD6VyNt9QrK9NciWPiK2J6tMonRF6zzoxf2b-jUqg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Jul 15, 2019 at 6:40 AM jeanclaude marzin <jeanclaude(dot)marzin(at)sfr(dot)fr>
wrote:

> ‌Hi
> I migrate from MSSQL to postgresql 11. I translate MSSQL stored procedure
> to Postgresql one :
>
> CREATE PROCEDURE procacp ()
> LANGUAGE SQL
> AS $$
> SELECT tabjdbexploit.jdbeid, tabjdbexploit.jdbeproc,
> tabjdbexploit.jdbedate, tabjdbexploit.jdbetypemsg,
> tabjdbexploit.jdbeurg, tabjdbexploit.jdbeconfid,
> tabjdbexploit.jdbeetat, tabmsgacp.acpid,
> tabmsgacp.acpnumserie,
> tabmsgacp.acpsignserv, tabmsgacp.acpnumligne,
> tabmsgacp.acpiaorigine, tabmsgacp.acpgdh,
> tabmsgacp.acperv, tabmsgacp.acpcdu,
> tabmsgacp.acpdir, tabmsgacp.acppere,
> tabmsgacp.acpcomplement, tabmsgacp.acpsection
>
> FROM tabjdbexploit INNER JOIN
> tabmsgacp ON tabjdbexploit.jdbeid = tabmsgacp.acpid
>
> ORDER BY tabjdbexploit.jdbedate ASC
> $$;
>
>
> All seems OK in PgAdmin 4, procedure is created
>
> I use ODBC and Crecorset in C++
>
> When i use the call strSQL = "{CALL procacp()}". It don't work :
>
> Message error : ERROR: procacp() is a procedure
>
> I don't know what to do
>
> Thanks in advance for any assistance
>
> Jean-Claude

I am fairly sure that you need to make an FUNCTION and not a PROCEDURE.
Functions return values. Procedures do not. Why not try replacing the word
PROCEDURE with FUNCTION and give it another try?

ref: https://www.postgresql.org/docs/11/xfunc.html

--
We all agree on the necessity of compromise. We just can't agree on when
it's necessary to compromise. -- Larry Wall

Maranatha! <><
John McKown

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Pavel Stehule 2019-07-15 13:02:21 Re: CRecordset::Open postgresql procedure call don't work
Previous Message Fabio Pardi 2019-07-15 11:35:29 Re: help understanding pgbench results