X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 80D52D1B532 for ; Mon, 10 Nov 2003 12:05:44 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 84640-08 for ; Mon, 10 Nov 2003 08:05:14 -0400 (AST) Received: from anchor-post-34.mail.demon.net (anchor-post-34.mail.demon.net [194.217.242.92]) by svr1.postgresql.org (Postfix) with ESMTP id 3ED17D1B540 for ; Mon, 10 Nov 2003 08:05:05 -0400 (AST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-34.mail.demon.net with esmtp (Exim 3.35 #1) id 1AJAn5-00016N-0Y; Mon, 10 Nov 2003 12:05:07 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 2BB5016E66; Mon, 10 Nov 2003 12:05:06 +0000 (GMT) Received: from client17.archonet.com (client17.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id AB8EC16E60; Mon, 10 Nov 2003 12:05:05 +0000 (GMT) From: Richard Huxton To: "Guillaume Houssay" , Subject: Re: FOR : Structure control pb Date: Mon, 10 Nov 2003 12:05:04 +0000 User-Agent: KMail/1.5 References: <00a201c3a77d$4457c820$eeac84c3@camille> In-Reply-To: <00a201c3a77d$4457c820$eeac84c3@camille> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200311101205.05037.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/83 X-Sequence-Number: 15898 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