| От | Richard Broersma Jr |
|---|---|
| Тема | Re: Getting a count from an update |
| Дата | |
| Msg-id | 243783.68253.qm@web31804.mail.mud.yahoo.com обсуждение |
| Ответ на | Getting a count from an update (Brian Hurt <bhurt@janestcapital.com>) |
| Список | 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.
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера