pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
dynamic SQL
2+ messages / 2 participants
[nested] [flat]

* dynamic SQL
@ 2008-09-10 15:45  davyd <davydky@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: davyd @ 2008-09-10 15:45 UTC (permalink / raw)
  To: pgsql-admin

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

Thanks..

^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: dynamic SQL
@ 2008-09-11 01:35  Scott Marlowe <scott.marlowe@gmail.com>
  parent: davyd <davydky@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Scott Marlowe @ 2008-09-11 01:35 UTC (permalink / raw)
  To: davyd <davydky@gmail.com>; +Cc: pgsql-admin

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.



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2008-09-11 01:35 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-09-10 15:45 dynamic SQL davyd <davydky@gmail.com>
2008-09-11 01:35 ` Scott Marlowe <scott.marlowe@gmail.com>

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