Re: Destination table by variable?

Поиск
Список
Период
Сортировка
От Afton & Ray Still
Тема Re: Destination table by variable?
Дата
Msg-id 002e01c52bd0$ba0d8f90$7c884146@rayshome
обсуждение исходный текст
Ответ на Destination table by variable?  ("Erik Dahlstrand" <df03daer@ing.hj.se>)
Ответы Re: [despammed] Re: Destination table by variable?  (Andreas Kretschmer <akretschmer@despammed.com>)
Список pgsql-novice
Hello Erik,
What front end are you using? I primarily use PHP, and this procedure is
simple. You just use string operations to put together your query however
you want. Use variables, math, concactanation, or ... .
The question you need to ask is: I'm using ______ as a front end and "I want
to choose the destination table by a variable." "Is it possible?
"
Ray
----- Original Message -----
From: "Erik Dahlstrand" <df03daer@ing.hj.se>
To: <pgsql-novice@postgresql.org>
Sent: Friday, March 18, 2005 7:35 AM
Subject: [NOVICE] Destination table by variable?


Hi!

I want to choose the destination table by a variable. Something like this:

CREATE FUNCTION insert_this(int4, varchar, varchar) RETURNS void AS $$
    DECLARE
        destTable text;
    BEGIN
        SELECT INTO destTable get_table_name($1);

        INSERT INTO destTable VALUES ($2, $3);
    END;
$$ LANGUAGE plpgsql;

Is it possible?

/Erik

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@postgresql.org so that your
      message can get through to the mailing list cleanly


--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 3/15/2005




--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.7.3 - Release Date: 3/15/2005


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

Предыдущее
От: "Erik Dahlstrand"
Дата:
Сообщение: Destination table by variable?
Следующее
От: Andreas Kretschmer
Дата:
Сообщение: Re: [despammed] Destination table by variable?