Re: Can you combine text variable together to referenece a VIEW name ?

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Can you combine text variable together to referenece a VIEW name ?
Date: 2007-04-09 18:56:25
Message-ID: 461A8C59.6060606@iol.ie
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 09/04/2007 00:36, Bigjim wrote:

> I am trying to combine 2 text variable togther to form the name of a
> VIEW. example
>
> SELECT * FROM ( 'april'||'may') ;

I think you want to use EXECUTE from within a pl/pgsql function to
construct and execute a query dynamically - have a look at this:

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

HTH,

Ray.

---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod(at)iol(dot)ie
---------------------------------------------------------------

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alvaro Herrera 2007-04-09 18:59:14 Re: Problem with copying data
Previous Message Alan Hodgson 2007-04-09 18:52:07 Re: Problem with copying data