From: Alain Reymond <al1.reymond@gmail.com>
To: pgsql-odbc@postgresql.org
Subject: Update
Date: Mon, 5 Jun 2017 17:16:03 +0200
Message-ID: <12c0ed39-08a0-6f19-f47b-caee35bc0b5b@gmail.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
--
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: al1.reymond@gmail.com
Subject: Re: Update
In-Reply-To: <12c0ed39-08a0-6f19-f47b-caee35bc0b5b@gmail.com>
References: <12c0ed39-08a0-6f19-f47b-caee35bc0b5b@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox