Re: Computed table name in function

Поиск
Список
Период
Сортировка
От Ray Madigan
Тема Re: Computed table name in function
Дата
Msg-id IIEPJABILGOCODDLDNJFAEEHCCAA.ray@madigans.org
обсуждение исходный текст
Ответ на Re: Computed table name in function  ("Scott Marlowe" <scott.marlowe@gmail.com>)
Ответы Re: Computed table name in function  (Daniel Drotos <drdani@mazsola.iit.uni-miskolc.hu>)
Re: Computed table name in function  (Richard Huxton <dev@archonet.com>)
Список pgsql-sql
I thought that the documentation said I couldn't use EXECUTE on a SELECT
INTO?

-----Original Message-----
From: pgsql-sql-owner@postgresql.org
[mailto:pgsql-sql-owner@postgresql.org]On Behalf Of Scott Marlowe
Sent: Wednesday, October 10, 2007 11:10 AM
To: Ray Madigan
Cc: Pgsql-Sql
Subject: Re: [SQL] Computed table name in function


On 10/10/07, Ray Madigan <ray@madigans.org> wrote:
> I have a problem that I don't know where to look to understand the
problem.
>
> I have a function that I first select to get a table name followed by
> another select into on that table name.  If someone could tell me where to
> look to solve this problem I would appreciate it.
>
> It is something like
>
> DECLARE rec1 Record;
>         rec2 Record;
>
> SELECT aName INTO rec1 FROM tableA WHERE new.xxx = ?;
>
> IF FOUND THEN
>
>     SELECT * INTO rec2 FROM rec1.aName where new.xxx = ?;

You have to build your query as a string then use execute on it.

---------------------------(end of broadcast)---------------------------
TIP 7: You can help support the PostgreSQL project by donating at
               http://www.postgresql.org/about/donate



В списке pgsql-sql по дате отправления:

Предыдущее
От: "Scott Marlowe"
Дата:
Сообщение: Re: Computed table name in function
Следующее
От: Daniel Drotos
Дата:
Сообщение: Re: Computed table name in function