On Wednesday 05 Mar 2003 5:10 pm, Ivan wrote:
> but its not SQL error but just in plpgsql ,
> SELECT INTO same_var sth from table;
> I can not write EXECUTE ''SELECT INTO same_var sth from table;'';
> because SELECT INTO not work with EXECUTE , so what can i do else ?
Ah, sorry, I see what you're trying to do now.
You're quite right, the SELECT INTO <plpgsql-variable> construct only works
within plpgsql, whereas EXECUTE runs standard SQL.
The solution is to use the FOR ... IN ... EXECUTE loop structure (even if you
only want one row) - see the manual section on plpgsql control structures
(programmers guide) for details. This is a known limitation of the EXECUTE
command and is mentioned in the relevant section, but perhaps not clearly
enough.
HTH
--
Richard Huxton