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:19:40 |
Message-ID: | 200101141019.XAA47026@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/
From | Date | Subject | |
---|---|---|---|
Next Message | Dan Langille | 2001-01-14 10:27:06 | getting number of rows updated within a procedure |
Previous Message | Jeff Duffy | 2001-01-14 08:01:40 | Can a PL/PgSQL function return a cursor? |