Help with Procedures in PL/pgsql

Поиск
Список
Период
Сортировка
От Nelio Alves Pereira Filho
Тема Help with Procedures in PL/pgsql
Дата
Msg-id 3A22AD0C.D599A10A@ifx.com.br
обсуждение исходный текст
Список 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

В списке pgsql-general по дате отправления:

Предыдущее
От: selkovjr@mcs.anl.gov
Дата:
Сообщение: Re: [HACKERS] Indexing for geographic objects?
Следующее
От: Jason
Дата:
Сообщение: Re: [PHP] a script that queries database periodically