pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
FOR : Structure control pb
2+ messages / 2 participants
[nested] [flat]

* FOR : Structure control pb
@ 2003-11-10 11:24 Guillaume Houssay <ghoussay@noos.fr>
  2003-11-10 12:05 ` Re: FOR : Structure control pb Richard Huxton <dev@archonet.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Guillaume Houssay @ 2003-11-10 11:24 UTC (permalink / raw)
  To: pgsql-sql

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

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: FOR : Structure control pb
  2003-11-10 11:24 FOR : Structure control pb Guillaume Houssay <ghoussay@noos.fr>
@ 2003-11-10 12:05 ` Richard Huxton <dev@archonet.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Richard Huxton @ 2003-11-10 12:05 UTC (permalink / raw)
  To: Guillaume Houssay <ghoussay@noos.fr>; pgsql-sql

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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2003-11-10 12:05 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-11-10 11:24 FOR : Structure control pb Guillaume Houssay <ghoussay@noos.fr>
2003-11-10 12:05 ` Richard Huxton <dev@archonet.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox