Re: Get count of records from SELECT

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: Get count of records from SELECT
Дата
Msg-id 20051115122757.GF7519@svana.org
обсуждение исходный текст
Ответ на Get count of records from SELECT  (Zet <skyer@on.kg>)
Список pgsql-general
On Tue, Nov 15, 2005 at 05:56:27PM +0300, Zet wrote:
> Hi
>
> I have example:

<snip>

> -- here I will get count of records in "rnum", but I need in LOOP's
> -- first step

You can't, because by that stage the query hasn't finished running yet.
What you need to do is put the output for the query in a temporary
table. Then GET DIAGNOSTICS will have the rowcount. Then you can loop
over that table.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Zet
Дата:
Сообщение: Get count of records from SELECT
Следующее
От: Christopher Browne
Дата:
Сообщение: Re: Choosing PostgreSQL as the database for our next project