How to Return number of rows updated in stored procedure

From: "Shane McEneaney" <shane(at)shadowbox(dot)ie>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: How to Return number of rows updated in stored procedure
Date: 2000-10-25 16:03:50
Message-ID: 019801c03e9d$2a810520$49dc7ac0@gamesnow.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,
can anybody tell me how to capture the number of rows updated in
an update query inside a stored procedure? This doesn't work but
hopefully you will see what I mean.

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

BEGIN
select into v_number_of_rows
update carbon_user
set email_confirmed = ''Y''
where email_confirmed = ''Y'';
RETURN v_myvar;
END;
' LANGUAGE 'plpgsql';

Thanks in advance!!!

Browse pgsql-sql by date

  From Date Subject
Next Message Clayton Cottingham 2000-10-25 16:16:21 Re: How to call a shell command in rule
Previous Message Blaise Carrupt 2000-10-25 10:48:38 Get a time from a char column