Skip site navigation (1) Skip section navigation (2)

Re: Problem with FOR LOOP query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Greg Quinn" <greg(at)officium(dot)co(dot)za>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Problem with FOR LOOP query
Date: 2007-01-11 20:26:32
Message-ID: 2449.1168547192@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-novice
"Greg Quinn" <greg(at)officium(dot)co(dot)za> writes:
> In my function I am trying to declare a variable of type RECORD.
> DECLARE curRecord RECORD;
> But it gives an error.

Worksforme.  You really need to provide a complete example and the
specific error you're getting if you want useful help.

> It also doesn't like my FOR LOOP

> FOR curRecord IN SELECT messageid from email_inbox where folderid = $1 LOOP
>     EXECUTE sp_deleteemailinboxmessagetodeleteditems(curRecord.messageid);
> LOOP;

I think the problem is the last line has to be END LOOP; ... though
again the specific text of the error would have made diagnosis a lot
more certain.

			regards, tom lane

In response to

pgsql-novice by date

Next:From: Alan T. MillerDate: 2007-01-11 21:17:35
Subject: grabbing id of previous and next record for current select
Previous:From: Greg QuinnDate: 2007-01-11 19:27:23
Subject: Problem with FOR LOOP query

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group