Search Postgresql Archives

Re: store multiple rows with the SELECT INTO statement

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Janek Sendrowski <janek12@xxxxxx> wrote:

> I just can't understabd why it's not possible to store multiple
> columns returning from a dynamic Select statement which is
> executet with EXECUTE into a temporary table.

You can:

CREATE TEMPORARY TABLE AS SELECT ...

http://www.postgresql.org/docs/current/interactive/sql-createtableas. html

As the Notes section says:

| This command is functionally similar to SELECT INTO, but it is
| preferred since it is less likely to be confused with other uses
| of the SELECT INTO syntax. Furthermore, CREATE TABLE AS offers a
| superset of the functionality offered by SELECT INTO.

Also see this:

http://www.postgresql.org/docs/current/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-ASSIGNMENT

| Tip: Note that this interpretation of SELECT with INTO is quite
| different from PostgreSQL's regular SELECT INTO command, wherein
| the INTO target is a newly created table. If you want to create a
| table from a SELECT result inside a PL/pgSQL function, use the
| syntax CREATE TABLE ... AS SELECT.

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux