Help with Procedures in pgsql

From: Nelio Alves Pereira Filho <nelio(at)ifx(dot)com(dot)br>
To: pgsql-sql(at)postgresql(dot)org
Subject: Help with Procedures in pgsql
Date: 2000-11-27 20:01:16
Message-ID: 3A22BD8C.A93790E1@ifx.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


I have the folowing procedure in PL/pgsql:

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

FOR nivel_rec IN SELECT * FROM nivel LOOP
new_count := set_counter_row (nivel_rec);
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? What's wrong
with it?
Does my procedure contain any other errors that will appear later?


Thanks

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Rob Burne 2000-11-27 20:20:49 Access Permissions/Security
Previous Message Jason 2000-11-27 19:54:38 Re: [PHP] a script that queries database periodically