Received: from comptechnews.com (cc993546-b.srst1.fl.home.com [24.3.77.52]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eB16OTF56326 for ; Fri, 1 Dec 2000 01:24:29 -0500 (EST) (envelope-from reaster@comptechnews.com) Received: from comptechnews (reaster@localhost [127.0.0.1]) by comptechnews.com (8.10.2/8.10.2) with SMTP id eB16WCK30145; Fri, 1 Dec 2000 01:32:12 -0500 From: "Robert B. Easter" Date: Fri, 1 Dec 2000 01:32:12 -0500 X-Mailer: KMail [version 1.1.99] Content-Type: text/plain; charset="us-ascii" To: Nelio Alves Pereira Filho , pgsql-sql@postgresql.org References: <3A22BD8C.A93790E1@ifx.com.br> In-Reply-To: <3A22BD8C.A93790E1@ifx.com.br> Subject: Re: Help with Procedures in pgsql MIME-Version: 1.0 Message-Id: <0012010132120Q.00289@comptechnews> Content-Transfer-Encoding: 8bit X-Archive-Number: 200012/2 X-Sequence-Number: 333 On Monday 27 November 2000 15:01, Nelio Alves Pereira Filho wrote: > I have the folowing procedure in PL/pgsql: > > CREATE FUNCTION set_counter () RETURNS INT AS ' > DECLARE > nivel_rec record; > new_count integer; I always used the syntax like: nivel_rec nivel%ROWTYPE; Not sure it matters though. > BEGIN > UPDATE nivel SET count=-2; > > FOR nivel_rec IN SELECT * FROM nivel LOOP > new_count := set_counter_row (nivel_rec); > END LOOP; I don't know what set_counter_row() is doing so the problem could be in that function. > > RETURN new_count; > END;' > LANGUAGE 'plpgsql'; > > I create it, but when I do 'select set_counter()', it says > IFX=# select set_counter(); > ERROR: Attribute 'nivel_rec' not found > > Isn't that the right sintax to declare variables in pgsql? What's wrong > with it? > Does my procedure contain any other errors that will appear later? > > > > Thanks -- -------- Robert B. Easter reaster@comptechnews.com --------- - CompTechNews Message Board http://www.comptechnews.com/ - - CompTechServ Tech Services http://www.comptechserv.com/ - ---------- http://www.comptechnews.com/~reaster/ ------------