Destination table by variable?

From: "Erik Dahlstrand" <df03daer(at)ing(dot)hj(dot)se>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Destination table by variable?
Date: 2005-03-18 14:35:37
Message-ID: s23af559.027@gw-smtp.hj.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

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

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Afton & Ray Still 2005-03-18 15:39:52 Re: Destination table by variable?
Previous Message Michael Glaesemann 2005-03-18 13:08:03 Re: Reference and arrays