Update

From: Alain Reymond <al1(dot)reymond(at)gmail(dot)com>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Update
Date: 2017-06-05 15:16:03
Message-ID: 12c0ed39-08a0-6f19-f47b-caee35bc0b5b@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hello,

We are using psqlodbc to update a Postgresql database from embedded sql
for cobol.
We have a strange behaviour : the first time we update, the update is
correct (sqlcode 0). I we try the same update, the system return sqlcode
= 100 and sqlstate = 2000.

postgresql.x86_64 9.2.18-1.el7
postgresql-odbc.x86_64 09.03.0100-2.el7
unixODBC.x86_64 2.3.1-11.el7
under Centos 7.2 64 bits.

Here an example to simulaute an upsert :

exec sql
UPDATE testtable SET
num = :testtable-num
, libelle = :testtable-libelle:testtable-libelle-NULL
WHERE num = :testtable-num;
end-exec
if sqlcode = 100 then
exec sql
INSERT into testtable
(
num
, libelle
)
SELECT
:testtable-num
, :testtable-libelle:testtable-libelle-NULL
WHERE NOT EXISTS (SELECT 1 FROM testtable WHERE num =
:testtable-num);
end-exec
end-if
if sqlcode = 0 then
exec sql commit end-exec
end-if

If I call two times the above code with the same content of
testtable-num and testtable-libelle, the first attempt is successful and
all other attempts, even changing the content of the variables, fails.

It was working good under Centos 5.9 32 bits, and Postgres 9.2.

Any idea why ?

Kind regards,

Alain

Responses

Browse pgsql-odbc by date

  From Date Subject
Next Message Matthew Shaer 2017-06-06 17:24:52 GSS from windows
Previous Message Adrian Klaver 2017-05-26 04:08:36 Re: odbc