Re: Help me do a LOOP

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Help me do a LOOP
Дата
Msg-id 43A921A8.3010702@archonet.com
обсуждение исходный текст
Ответ на Help me do a LOOP  (Calin Meze <mezecalin@yahoo.com>)
Список pgsql-sql
Calin Meze wrote:
> I need to test each record of a cursor for some requirements,
> something like this
[snip]
> -- the problem is that I do not know how to make the while loop
> execute  until the last record "WHILE (still in the cursor)"... So I
> need  something like
> 
> 
> Can anyone help me with this? It really seems silly... but I cannot
> get  to solve this, I do not know where to look for syntax like this
> or  tutorials  like this.

Assuming this is plpgsql you are probably looking for the FOUND 
pseudo-variable. See Ch 36.6.6 Obtaining the Result Status

You don't actually need to bother with a cursor in plpgsql, just loop 
over a SELECT (Ch 36.7.4 Looping Through Query Results). That basically 
*is* a cursor internally.

--   Richard Huxton  Archonet Ltd


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

Предыдущее
От: vishal saberwal
Дата:
Сообщение: Re: [GENERAL] Question on indexes
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Commiting after certain no of rows have been deleted