Обсуждение: FOR : Structure control pb

Поиск
Список
Период
Сортировка

FOR : Structure control pb

От
"Guillaume Houssay"
Дата:
I am using the For controle structure as follows
 
FOR i IN 0..23 LOOP
 
query
 
END LOOP;
 
The query is tested and is working OK.
 
When I launch the loop in psql interface, I get the error parse error at or near FOR.
 
As this is the first time I use this kind of struture I am probably using it the wrong way.
 
Thank you for your answer

Re: FOR : Structure control pb

От
Richard Huxton
Дата:
On Monday 10 November 2003 11:24, Guillaume Houssay wrote:
> I am using the For controle structure as follows
>
> FOR i IN 0..23 LOOP
>
> query
>
> END LOOP;
>
> The query is tested and is working OK.
>
> When I launch the loop in psql interface, I get the error parse error at or
> near FOR.

The FOR loop is a plpgsql block not an SQL one. You'll need to write a plpgsql 
function if you want to use it.

--  Richard Huxton Archonet Ltd