Обсуждение: question about looping through records in plpgsql

Поиск
Список
Период
Сортировка

question about looping through records in plpgsql

От
Michael Davis
Дата:
Here is a function that loops through membership records.  I have tried many
different variations of this but have not been able to make this work.  Has
any one been able to get something similar to this working?  Is there any
additional documentation on plpgsql?  Is there a another language that would
be better for something like this?

CREATE FUNCTION test(varchar, varchar) RETURNS int2 AS '
DECLARE
options ALIAS FOR $1;
username ALIAS FOR $2;
mid int4;
BEGIN
FOR row IN select * from membership LOOP
    statements;
END LOOP;
return 0;
END; ' LANGUAGE 'plpgsql';


Thanks, Michael