Make a LOOP function with a delay

Поиск
Список
Период
Сортировка
От James David Smith
Тема Make a LOOP function with a delay
Дата
Msg-id CAMu32ACFeqyAAVj4wVmCJM6pPT0FTkRZQbgyv9vTEMP0nEaRow@mail.gmail.com
обсуждение исходный текст
Ответы Re: Make a LOOP function with a delay  (Merlin Moncure <mmoncure@gmail.com>)
Список pgsql-novice
Hi there,

I have a query as below which works great and does exactly what I want
it too. It has this form:

SELECT my_function(
field_one,
field_two,
field_three,
field_four
)
FROM my_table
WHERE row_number = 1;

However I want to make it loop and run the function for each row of
my_table. I'd also like to put a delay in it. But I'm not quite sure
how. The pseudo-code would be:

1) Take the first row from the table
2) Run the function with the row number in the WHERE clause
3) Pause for 5 seconds
4) Move to the next row
5) Run the function again
etc... until the whole table is done.

I'd really appreciate some guidance please. I've looked at loops in
the manual but it's a steep learning curve...

Thanks

James


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

Предыдущее
От: Athanasios Kostopoulos
Дата:
Сообщение: Re: pg_hba.conf & non-static IP address
Следующее
От: Merlin Moncure
Дата:
Сообщение: Re: Make a LOOP function with a delay