Hello group,<br /><br /> I've a bunch of tables, which have just about the same name. They are just iterated like
this:<br/><br /> tbl_table1<br /> tbl_table2<br /> tbl_table3<br /> ...<br /><br /> They all have the same field, but
differentdata.<br /><br /> Now I'm wondering, if I have to write functions for every table, although they perform the
sameoperation?<br /> Or is it possible to pass an integer parameter to the function, use it to put the right tablename
togetherand perform the operation.<br /><br /> This would something look like this:<br /><br /> CREATE OR REPLACE
functiongetmaxuserid(integer) RETURNS integer AS'<br /> DECLARE tmp_tmp_tmp_table varchar(100);<br /> DECLARE
tmp_tablevarchar(100);<br /> DECLARE tmp_tmp_table varchar(100);<br /> DECLARE live_table
varchar(100);<br/> DECLARE i_return integer;<br /> BEGIN<br /> --live_table := ''tbl_highscore_app'' ||
cast($1as varchar);<br /> SELECT max(userid) FROM ''tbl_highscore_app'' || cast($1 as varchar);<br /> <br
/> <br /><br /> return(0);<br /> END;<br /> 'LANGUAGE 'plpgsql' VOLATILE CALLED ON NULL INPUT SECURITY
INVOKER;<br/><br /><br /> I don't know if this is good practise, but I'm trying to create a function which gets an
integer.<br clear="all" /><br /><br />