Forum OpenACS Q&A: Response to Slow SubSelect in BBoard Forum

Collapse
Posted by Don Baccus on
It's saying that SELECT INTO means something different in PL/pgSQL as opposed to in the SQL engine proper, and that they recommend you use CREATE TABLE AS instead in SQL.

In PL/pgSQL SELECT INTO means the same as it does in Oracle's PL/SQL (which PL/pgSQL is modelled after). The idea is that you define some variables, say "v_foo" and "v_bar" and then select into those variables like this:

select t.foo, t.bar into v_foo, v_bar
from table t
where some_key = 'some_value';
Afterwards, v_foo and v_bar are available for use in your code. Grep around the OpenACS 4.5 sources for examples of this - there are tons of them.