Re: How do I replace select ... into commands?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Richard Sydney-Smith" <richard(at)ibisaustralia(dot)com>
Cc: "Stephan Szabo" <sszabo(at)megazone(dot)bigpanda(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: How do I replace select ... into commands?
Date: 2003-09-12 03:20:07
Message-ID: 6095.1063336807@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-sql

"Richard Sydney-Smith" <richard(at)ibisaustralia(dot)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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Sydney-Smith 2003-09-12 05:06:57 Re: How do I replace select ... into commands?
Previous Message Richard Sydney-Smith 2003-09-12 02:59:08 Re: How do I replace select ... into commands?