Re: getting number of rows updated within a procedure

From: "J(dot)H(dot)M(dot) Dassen (Ray)" <jdassen(at)cistron-office(dot)nl>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: getting number of rows updated within a procedure
Date: 2001-01-15 07:44:46
Message-ID: 20010115084445.A696@cistron-office.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)Yahoo(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message J.H.M. Dassen (Ray) 2001-01-15 07:50:05 Re: 'Tuple is too big' Error
Previous Message Tom Lane 2001-01-15 07:32:17 Re: createdb fails in 7.0.2