Re: How do I replace select ... into commands? - Mailing list pgsql-sql

From Tom Lane
Subject Re: How do I replace select ... into commands?
Date
Msg-id 6095.1063336807@sss.pgh.pa.us
Whole thread Raw
In response to Re: How do I replace select ... into commands?  ("Richard Sydney-Smith" <richard@ibisaustralia.com>)
List pgsql-sql
"Richard Sydney-Smith" <richard@ibisaustralia.com> writes:
>       execute ''select max('' || seq_fld || '') into mx from '' || tbl;

You can't use INTO in an EXECUTE'd select (basically because the string
to be executed is not processed by plpgsql at all, merely sent down to
the SQL engine, which does not know the output variable mx).  The way to
get results out of an executed select is to use FOR ... IN EXECUTE.
Which is a kluge, but it holds the fort until someone gets around to
redesigning this code.  See the manual.
        regards, tom lane


pgsql-sql by date:

Previous
From: "Richard Sydney-Smith"
Date:
Subject: Re: How do I replace select ... into commands?
Next
From: "Richard Sydney-Smith"
Date:
Subject: Re: How do I replace select ... into commands?