Re: Error when trying to use a FOR loop

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Kevin Nikiforuk <Kevin(dot)Nikiforuk(at)Acrodex(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Error when trying to use a FOR loop
Date: 2006-07-20 20:19:25
Message-ID: 20060720131715.M89811@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, 20 Jul 2006, Kevin Nikiforuk wrote:

> Sorry if this is in the archives, but I've done a search and couldn't
> find anything relevant. I'm running HP's precompiled version of 8.1.3.1
> as part of their Internet Express offering, and I can't seem to run a
> for loop. Here's what I'm seeing:
>
> xp512-0715-0716=# FOR LV in 1..10 LOOP
>
> xp512-0715-0716-# select * from ldevrg;
>
> ERROR: syntax error at or near "FOR" at character 1
>
> LINE 1: FOR LV in 1..10 LOOP

I think the problem is that the FOR is a pl/pgsql construct and isn't
allowed in straight sql contexts but only inside a function.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Broersma Jr 2006-07-20 20:25:30 Re: Error when trying to use a FOR loop
Previous Message Stephan Szabo 2006-07-20 20:17:10 Re: Help with privilages please