From: Scott Marlowe <scott.marlowe@gmail.com>
To: davyd <davydky@gmail.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: dynamic SQL
Date: Wed, 10 Sep 2008 19:35:13 -0600
Message-ID: <dcc563d10809101835p612698d0t5b402e518f57de52@mail.gmail.com> (raw)
In-Reply-To: <a354e4430809100845r4a85d789u535ef54ce9adb46a@mail.gmail.com>
References: <a354e4430809100845r4a85d789u535ef54ce9adb46a@mail.gmail.com>
On Wed, Sep 10, 2008 at 9:45 AM, davyd <davydky@gmail.com> wrote:
> Hi list,
> I need to create a sql where the name of a tabla is on a variable..
>
> vbuffer varchar;
>
> SELECT buffer
> INTO vbuffer
> FROM rutas r, unidades u
> WHERE r.codigo_ruta = u.codigo_ruta AND
> u.codigo_uni = 'B15_AFF666';
>
>
> SELECT within(the_geom,(SELECT geomunion(the_geom) from var vbuffer)) as
> inside
You'll need to do it by building the query as a string in a plpgsql
function and then execute it.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: scott.marlowe@gmail.com, davydky@gmail.com
Subject: Re: dynamic SQL
In-Reply-To: <dcc563d10809101835p612698d0t5b402e518f57de52@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox