Thread: Plpgsql qestion

Plpgsql qestion

From
"Yury Don"
Date:
 Hi All.

 Is it possible to create function (preferably in plpgsql) which gets table
name and field name as an arguments and does select something from this
table?
Something like

 CREATE FUNCTION "ft"
   (text, text)
   RETURNS int4
   AS '
   declare
      res int4;
   begin
      select max($2) from $1 into res;
      return res;
   end;
   '
   LANGUAGE 'plpgsql'

 Sincerely yours, Yury.
don.web-page.net, ICQ 11831432