Received: from golem.jpl.nasa.gov (root@hectic-3.jpl.nasa.gov [128.149.68.205]) by hub.org (8.8.8/8.7.5) with ESMTP id JAA29487 for ; Thu, 16 Jul 1998 09:34:33 -0400 (EDT) Received: from alumni.caltech.edu (localhost [127.0.0.1]) by golem.jpl.nasa.gov (8.8.5/8.8.5) with ESMTP id NAA01094; Thu, 16 Jul 1998 13:41:00 GMT Sender: tgl@mythos.jpl.nasa.gov Message-ID: <35AE02EC.14ED75A6@alumni.caltech.edu> Date: Thu, 16 Jul 1998 13:41:00 +0000 From: "Thomas G. Lockhart" Organization: Caltech/JPL X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.30 i686) MIME-Version: 1.0 To: Benedikt Eric Heinen CC: pgsql-interfaces@postgreSQL.org Subject: Re: [INTERFACES] ecpg SQL-return codes? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit > how do I determine the result from an SQL statement in an ecpg source? > >From using adabas/oracle I am somewhat used to using sqlca.sqlcode, but > when I did a simple test yesterday (trying to update a row in an empty > table, which of course fails, since there is nothing to update in the > table) reveiled sqlca.sqlcode to have a value of 0. Well, it of course succeeded! :) SQL is set-oriented, and updating no matching rows is a valid result. Now, if you mis-type the update command so there is a syntax or naming error, you will probably find an error return. Also, if you do a select on a cursor, then loop through, you might find a return code of "100" when there are no more rows to select. But updates on well-formed queries are likely to succeed and return zero. - Tom