Re: getting number of rows updated within a procedure - Mailing list pgsql-general

From J.H.M. Dassen (Ray)
Subject Re: getting number of rows updated within a procedure
Date
Msg-id 20010115084445.A696@cistron-office.nl
Whole thread Raw
In response to getting number of rows updated within a procedure  ("Dan Langille" <dan@langille.org>)
Responses Re: getting number of rows updated within a procedure
List pgsql-general
On Sun, Jan 14, 2001 at 23:27:06 +1300, Dan Langille wrote:
> I'm writing some stuff in PL/pgsql (actually, a lot of stuff).  I have a
> question: At various times, it does UPDATEs.  Is there a way to tell if
> the UPDATE actually affected any rows or not?  I couldn't see how to get
> UPDATE to return anything.

Quoting a recent message by Jan Wieck <janwieck@Yahoo.com>:
:Do a
:
:    GET DIAGNOSTICS SELECT PROCESSED INTO <int4_variable>;
:
:directly  after  an  INSERT,  UPDATE  or DELETE statement and you'll know
:how many rows have been hit.
:
:Also you can get the OID of an inserted row with
:
:    GET DIAGNOSTICS SELECT RESULT INTO <int4_variable>;

HTH,
Ray
--
"The software `wizard' is the single greatest obstacle to computer literacy
since the Mac."
    http://www.osopinion.com/Opinions/MichaelKellen/MichaelKellen1.html

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: createdb fails in 7.0.2
Next
From: "J.H.M. Dassen (Ray)"
Date:
Subject: Re: 'Tuple is too big' Error