Received: from chronozon.dyndns.org (cr466046-a.etob1.on.wave.home.com [24.112.191.209]) by hub.org (8.9.3/8.9.3) with ESMTP id UAA53472 for ; Tue, 23 May 2000 20:37:43 -0400 (EDT) (envelope-from stef@chronozon.dyndns.org) Received: by chronozon.dyndns.org (Postfix, from userid 501) id C37C31F57C; Tue, 23 May 2000 20:36:43 -0500 (CDT) To: pgsql-sql@postgresql.org Subject: Clarified Question Message-Id: <20000524013643.C37C31F57C@chronozon.dyndns.org> Date: Tue, 23 May 2000 20:36:43 -0500 (CDT) From: stef@chronozon.dyndns.org (Stef telford) X-Archive-Number: 200005/113 Hello, Earlier I sent in some ramblings trying to explain my problm. I think I have it better summarised now. How can I create a function that will take in two variables and return an integer, when one of the variables is the tablename ?! I have tried : create function tst_func(text, varchar(16)) as 'BEGIN result=select max(history_id)+1 from $1 where client_id = $2; return result; END;' Please excuse the roughness of the code, I am not at my work machine where I have postgres all setup. (oh. and jst a little query, is the 'max' actaully a stored procedure or an SQL keyword ?! I cant seem to find it in any of the documentation probbly cause I overlooked it ;) Thanks, Steffs