hello! i have the following function: CREATE FUNCTION plusSum(text,int4) RETURNS int4 AS ' DECLARE jrlname ALIAS FOR $1; sumup ALIAS FOR $2; actsum int4; arow RECORD; conversion float8; temp float8; sum float8; BEGIN sum := 0; RAISE NOTICE ''stats % '', sumup; FOR arow IN SELECT * FROM "jrlname" WHERE plus=sumup LOOP SELECT conv FROM currencies WHERE tag=arow.currency INTO conversion; sum := sum + (arow.amount/conversion); END LOOP; return round(sum); END; ' LANGUAGE 'plpgsql'; select plusSum('journal','102'); and i get an error: ERROR: parser: parse error at or near "$1" (BTW would be helpful if the thing could spit out also the line number....) isolated the prob to this line: FOR arow IN SELECT * FROM "jrlname" WHERE plus=sumup LOOP in fact it doesn't seem to like the fact that i use a dynamic table name?? i remind vaguely that pl/psql had indeed this sort of problem... but this was years ago.... is there any workaround? even using perl? The whole prog is a bookkeeping program... and i want it now really able to work with several sets of tables.... without duplicating also the functions i wrote associated to the tables.... BTW is there a possibility to make further select calls out of plperl? (an example making this would come in handy...) i am using a postgres7.03 DB on a debian system... -- ciao bboett ============================================================== [EMAIL PROTECTED] http://inforezo.u-strasbg.fr/~bboett http://erm1.u-strasbg.fr/~bboett =============================================================== the total amount of intelligence on earth is constant. human population is growing.... ---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster