How to run loop in psql?

Поиск
Список
Период
Сортировка
От A B
Тема How to run loop in psql?
Дата
Msg-id AANLkTik4oK48QGPXE6SY0fjONZhZjzEoCaM9tWwNzcal@mail.gmail.com
обсуждение исходный текст
Ответы Re: How to run loop in psql?  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Список pgsql-novice
Hello there.

Perhaps I'm supposed to know this, but how can I run a function on
each query result in psql?

I run the query  select a,b from foo where x=y; and I would like to
run the function bar(u,v) for each result from the query and using
the values of a and b as parameters to the function.
How can I do that in psql?


Something like:

for x in select a,b from foo where x=y loop
    select bar(x.a,x.b);
end loop;

would be great!

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

Предыдущее
От: Jasen Betts
Дата:
Сообщение: Re: (not so?) silly question
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: How to run loop in psql?