Thread: Newbie help needed on Functions
I'm not an expert, but I think that a function cannot directly return a rows set. You have to use a cursor
http://www.postgresql.org/idocs/index.php?plpgsql-cursors.html
I use the following (postgresql 7.2) to get multiple rows in a table, but the table must exist before you run the function.
Don't forget double quotes (1+1) for the variable in the query
You have to install pl/pgsql language before ...
CREATE FUNCTION test(varchar) RETURNS varchar AS ' declare declare
begin
str_ok = 'OK' drop create
return str_ok;
end;
' LANGUAGE 'pl/pgsql';
___________________________________________
Jacques Massé
Tel. 33 (0)5 57 89 08 11 - Fax 33 (0)5 57 89 08 01
-----Message d'origine-----
De : Jim Steil [mailto:jim.steil@customcall.com]
Envoyé : mardi 24 septembre 2002 19:59
À : pgsql-novice@postgresql.org
Objet : [NOVICE] Newbie help needed on FunctionsHi:I want to create a function that will return rows from a table based upon a parameter that I pass.