On Wed, Jan 27, 2010 at 10:40:17AM -0500, Aycock, Jeff R. wrote: > EXECUTE 'SELECT *, $1, now() INTO schema_1.'||whoami||' FROM schema_2.'||whoami||' where created_dt between $2 and $3;' You'll also need to expand those other parameters. The code is executed in an independent scope and hence PG doesn't know what $1, $2 or $3 are. The builtin function "quote_literal" is probably best to use here, especially for the TEXT type. -- Sam http://samason.me.uk/ -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general