Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-novice by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group