On Sunday 07 January 2001 02:23, Robert B. Easter wrote:
> Can I see your function that tried to do it? Pg 7.1 beta has a new EXECUTE
> statement for PL/pgSQL that allows execution of a query string that can be
> created dynamically (see the development docs at www.postgresql.org). It
> might be relevant to your problem.
Thanks for your attention
I have this function:
CREATE FUNCTION free_id() RETURNS int4
as 'SELECT id from pers_id where flag=0'
LANGUAGE 'sql';
I have to duplicate it 4 o 5 times, so I thougth to write something like
CREATE FUNCTION free_id(text) RETURNS int4
as 'SELECT id from $1 where flag=0'
LANGUAGE 'sql';
to specify different tables when I call the function.
I tried to put different things from '(text)' after the function name, but it
gives me always an error. I tried also to use the other syntax in select
(which I saw in the manual is preferred in functions):
CREATE FUNCTION free_id(text) RETURNS int4
as 'SELECT $1.id where flag=0'
LANGUAGE 'sql';
but I got nothing good...
any idea? (it's a matter of theory, 'cause I don't care to write down 1 or 4
functions...)
have a good day
--
gianpaolo racca
gianpaolo@preciso.net
http://www.preciso.net