getting number of rows updated within a procedure

From: "Dan Langille" <dan(at)langille(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: getting number of rows updated within a procedure
Date: 2001-01-14 10:27:06
Message-ID: 200101141027.XAA47088@ducky.nz.freebsd.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm writing a procedure and I want to check the number of rows updated.
But I can't figure out how. I know UPDATE returns "UPDATE #" but I
don't know how to use that to get what I need.

Here's an example:

CREATE FUNCTION "test" () RETURNS int AS ' DECLARE
v_number_of_rows int;

BEGIN update bigtable set email_confirmed = 1
where user_group = 1234;

-- and here, I want to know the number of rows updated
v_number_of_rows := *what?*;

END; ' LANGUAGE 'plpgsql';

Thanks.

--
Dan Langille
The FreeBSD Diary - http://freebsddiary.org/
FreshPorts - http://freshports.org/
NZ Broadband - http://unixathome.org/broadband/

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Konstantinos Agouros 2001-01-14 10:57:40 stupid select question...
Previous Message Dan Langille 2001-01-14 10:19:40 getting number of rows updated within a procedure