Friday, May 30, 2008

[NOVICE] How does quotes work with dynamic queries?

I have this code iin my plpgsql function

DECLARE
foo text;
begin
foo:='bar';
execute ....

and now I want to select currval() from the sequence whose name is
stored in the foo variable, with the execute command.

can I do
execute 'select currval( \'' || foo || '\')';
?

--
Sent via pgsql-novice mailing list (pgsql-novice@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-novice

No comments: