Re: Destination table by variable? - Mailing list pgsql-novice

From Afton & Ray Still
Subject Re: Destination table by variable?
Date
Msg-id 002e01c52bd0$ba0d8f90$7c884146@rayshome
Whole thread Raw
In response to Destination table by variable?  ("Erik Dahlstrand" <df03daer@ing.hj.se>)
Responses Re: [despammed] Re: Destination table by variable?
List 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 by date:

Previous
From: "Erik Dahlstrand"
Date:
Subject: Destination table by variable?
Next
From: Andreas Kretschmer
Date:
Subject: Re: [despammed] Destination table by variable?