Re: función que inserte filas en una tabla temporal

From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: guillermoariast(at)linuxwaves(dot)com
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: función que inserte filas en una tabla temporal
Date: 2007-08-10 00:03:58
Message-ID: c2d9e70e0708091703g59440d25uda9c6ca18310fb54@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

On 8/9/07, guillermo arias <guillermoariast(at)linuxwaves(dot)com> wrote:
>
> Cómo puedo hacer la siguiente función:
>

http://www.postgresql.org/docs/8.2/static/xplang.html

> - Hacer una consulta a una tabla y derivar el resultado a una tabla
> temporal.

http://www.postgresql.org/docs/8.2/static/sql-createtableas.html
http://www.postgresql.org/docs/8.2/static/sql-selectinto.html

> - Hacer consulta a otra tabla que tiene menos columnas e insertar estos
> registros a la tabla temporal.

insert into tabla_temporal select ....

> - Finalmente hacer un select a esta tabla temporal.
>

select ...

PS: tratandose de tablas temporales pon todas las sentencias que hagan
referencia en la tabla temporal en strings y ejecutalas con EXECUTE
(esto es debido a un problema que existe en postgres hasta 8.2, en 8.3
esto ya no sera necesario)

http://www.postgresql.org/docs/8.2/static/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN
http://www.postgresql.org/docs/8.2/static/plpgsql-development-tips.html#PLPGSQL-QUOTE-TIPS

--
Atentamente,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Jaime Casanova 2007-08-10 00:16:04 Re: Mayusculas/minusculas key sensitive, su ayuda por favor
Previous Message Jaime Casanova 2007-08-09 23:46:28 Re: roadmap postgresql