Re: function, that uses different table(names)

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: function, that uses different table(names)
Date: 2005-11-02 13:38:52
Message-ID: 20051102133852.GH12416@webserv.wug-glas.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

am 02.11.2005, um 14:30:38 +0100 mailte Moritz Bayer folgendes:
> Hello group,
>
> I've a bunch of tables, which have just about the same name. They are just
> iterated like this:
>
> tbl_table1
> tbl_table2
> tbl_table3
> ...
>
> They all have the same field, but different data.
>
> Now I'm wondering, if I have to write functions for every table, although
> they perform the same operation?
> Or is it possible to pass an integer parameter to the function, use it to
> put the right tablename together and perform the operation.

Yes, this is possible. Please read the documentation:
http://www.postgresql.org/docs/8.0/interactive/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN

HTH, Andreas
--
Andreas Kretschmer (Kontakt: siehe Header)
Heynitz: 035242/47212, D1: 0160/7141639
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
=== Schollglas Unternehmensgruppe ===

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2005-11-02 13:56:05 Re: function, that uses different table(names)
Previous Message Moritz Bayer 2005-11-02 13:36:06 Re: function, that uses different table(names)