Help with Procedures in PL/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 PL/pgsql
Date: 2000-11-27 18:50:52
Message-ID: 3A22AD0C.D599A10A@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 Tom Lane 2000-11-27 19:07:16 Re: [HACKERS] Indexing for geographic objects?
Previous Message selkovjr 2000-11-27 18:36:42 Re: [HACKERS] Indexing for geographic objects?