X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 99906D6881 for ; Wed, 2 Nov 2005 09:38:30 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 50381-08 for ; Wed, 2 Nov 2005 13:38:27 +0000 (GMT) Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.188]) by svr1.postgresql.org (Postfix) with ESMTP id 14BB5D6868 for ; Wed, 2 Nov 2005 09:38:28 -0400 (AST) Received: from [194.25.154.138] (helo=webserv.wug.de) by mrelayeu.kundenserver.de (node=mrelayeu8) with ESMTP (Nemesis), id 0ML2ov-1EXIox2tVd-0001aY; Wed, 02 Nov 2005 14:38:31 +0100 Received: from kretschmer by webserv.wug.de with local (Exim 3.36 #1) id 1EXIpI-0006p0-00 for pgsql-sql@postgresql.org; Wed, 02 Nov 2005 14:38:52 +0100 Date: Wed, 2 Nov 2005 14:38:52 +0100 From: "A. Kretschmer" To: pgsql-sql@postgresql.org Subject: Re: function, that uses different table(names) Message-ID: <20051102133852.GH12416@webserv.wug-glas.de> Mail-Followup-To: "A. Kretschmer" , pgsql-sql@postgresql.org References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-DEST: 208 X-MSMail-Priority: High X-Message-Flag: Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect. (Linus Torvalds) X-OS: Linux - weil ich es mir Wert bin! X-Info: registrierter Linux-User 97922 http://counter.li.org User-Agent: mutt-ng 1.5.9i (Linux) X-Provags-ID: kundenserver.de abuse@kundenserver.de login:51ea9561fc3f6d9539a2acd743e4748c X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=1.394 required=5 tests=[AWL=0.000, MISSING_MIMEOLE=1.394] X-Spam-Score: 1.394 X-Spam-Level: * X-Archive-Number: 200511/23 X-Sequence-Number: 23275 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 ===