Re: [SQL] Error when trying to use a FOR loop

2006-07-21 Thread Stephan Szabo
On Fri, 21 Jul 2006, Kevin Nikiforuk wrote: > Many thanks to Stephan, Richard and George. When I was reading the > documentation about FOR loops, I didn't realize that I was in the plpgsql > section! > > CREATE OR REPLACE FUNCTION rgio() RETURNS integer as $$ > BEGIN > DECLARE lv RECORD

Re: [SQL] Error when trying to use a FOR loop

2006-07-21 Thread Tom Lane
"Kevin Nikiforuk" <[EMAIL PROTECTED]> writes: > CREATE OR REPLACE FUNCTION rgio() RETURNS integer as $$ > BEGIN > DECLARE lv RECORD; > FOR lv IN SELECT DISTINCT rg FROM ldevrg LOOP > SELECT ldev FROM ldevrg WHERE ldevrg='$lv'; > END LOOP; > RETURN 1; > END; >

Re: [SQL] Error when trying to use a FOR loop

2006-07-21 Thread A. Kretschmer
am 21.07.2006, um 9:26:21 -0600 mailte Kevin Nikiforuk folgendes: > Many thanks to Stephan, Richard and George. When I was reading the > documentation about FOR loops, I didn't realize that I was in the plpgsql > section! > > CREATE OR REPLACE FUNCTION rgio() RETURNS integer as $$ > BEGIN >

Re: [SQL] Error when trying to use a FOR loop

2006-07-21 Thread Kevin Nikiforuk
AM To: pgsql-sql@postgresql.org Subject: [SQL] Error when trying to use a FOR loop 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 c

Re: [SQL] Error when trying to use a FOR loop

2006-07-20 Thread George Weaver
- Original Message From: "Kevin Nikiforuk" xp512-0715-0716=# FOR LV in 1..10 LOOP It appears that you are trying to use the For .. Loop structure from the psql command line. This structure is not plain SQL - its meant to be used within PL/pgSQL. Have you tried incorporating it int

Re: [SQL] Error when trying to use a FOR loop

2006-07-20 Thread Richard Broersma Jr
> 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

Re: [SQL] Error when trying to use a FOR loop

2006-07-20 Thread Stephan Szabo
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:

[SQL] Error when trying to use a FOR loop

2006-07-20 Thread Kevin Nikiforuk
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-071