From: | Richard Broersma Jr <rabroersma(at)yahoo(dot)com> |
---|---|
To: | Brian Hurt <bhurt(at)janestcapital(dot)com>, pgsql-novice(at)postgresql(dot)org |
Subject: | Re: Getting a count from an update |
Date: | 2006-12-14 20:20:59 |
Message-ID: | 243783.68253.qm@web31804.mail.mud.yahoo.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
> Newbie question here: I want to be able to capture the count of the
> number of rows updated from an update command within SQL. I know that
> psql prints out the result, I want to grab it within a function. The
> update is a simple "UPDATE tablename SET col = value WHERE othercol =
> otherval;", which will generally update many dozens or hundreds of
> rows. Currently I'm doing a select before doing the update, but since
> I'm doing a select count(*) I can't add a 'for update' to the end and
> lock the rows. Is there a better way to do this?
Maybe you can use the new "returning" syntax to your query can get to count of rows affected.
Regards,
Richard Broersma Jr.
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Broersma Jr | 2006-12-14 20:27:33 | Re: Upgrade to PGSQL 8.2 Problem |
Previous Message | Brian Hurt | 2006-12-14 19:56:51 | Getting a count from an update |