Help with Procedures in pgsql

From: Nelio Alves Pereira Filho <nelio(at)ifx(dot)com(dot)br>
To: pgsql-general(at)postgresql(dot)org
Subject: Help with Procedures in pgsql
Date: 2000-11-27 18:32:31
Message-ID: 3A22A8BF.DEB13BB5@ifx.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I have the folowing procedure:

CREATE FUNCTION set_counter () RETURNS INT AS '
DECLARE
nivel_rec record;
new_count integer;
BEGIN
UPDATE nivel SET count=-1;

FOR nivel_rec IN SELECT * FROM nivel LOOP
new_count := set_counter_row (nivel_rec);
UPDATE nivel SET count = new_count WHERE id = nivel_rec.id;
END LOOP;

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? Does my
procedure contain any other errors that will appear later?

Thanks

--
Nelio Alves Pereira Filho
IFX Networks
Sao Paulo / Brazil

Browse pgsql-general by date

  From Date Subject
Next Message Wade D. Oberpriller 2000-11-27 18:33:29 Re: Re[2]: Queries in plperl
Previous Message Francis Solomon 2000-11-27 18:31:45 RE: MS-Access: MySQL vs. PostgreSQL