pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Shane McEneaney <shane@shadowbox.ie>
To: pgsql-sql@postgresql.org
Subject: Return number of rows update in query
Date: Mon, 20 Nov 2000 15:08:06 -0000
Message-ID: <008701c05303$d1f51100$49dc7ac0@gamesnow.ie> (raw)

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!!!

Shane




Message-ID: <008701c05303$d1f51100$49dc7ac0@gamesnow.ie>
Permalink:  ../008701c05303$d1f51100$49dc7ac0@gamesnow.ie/
Also on:    postgresql.org/message-id/008701c05303$d1f51100$49dc7ac0@gamesnow.ie

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: shane@shadowbox.ie
  Subject: Re: Return number of rows update in query
  In-Reply-To: <008701c05303$d1f51100$49dc7ac0@gamesnow.ie>
  References: <008701c05303$d1f51100$49dc7ac0@gamesnow.ie>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox