X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id B847F528A9 for ; Mon, 6 Jun 2005 13:52:43 -0300 (ADT) 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 35714-04 for ; Mon, 6 Jun 2005 16:52:39 +0000 (GMT) Received: from web11.manitu.net (web11.manitu.net [217.11.48.111]) by svr1.postgresql.org (Postfix) with ESMTP id D38CC52891 for ; Mon, 6 Jun 2005 13:52:37 -0300 (ADT) Received: from dicaprio.akademie1.de (dicaprio.akademie1.de [62.165.4.166]) (authenticated) by web11.manitu.net (8.10.2-SOL3/8.10.2) with ESMTP id j56GqZT29834 for ; Mon, 6 Jun 2005 18:52:35 +0200 Subject: SQL equivalent to nested loop From: Markus Bertheau =?UTF-8?Q?=E2=98=AD?= To: pgsql-sql@postgresql.org Content-Type: text/plain; charset=UTF-8 Date: Mon, 06 Jun 2005 18:52:31 +0200 Message-Id: <1118076751.5506.17.camel@dicaprio.akademie1.de> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 (2.0.4-4) Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.119 tagged_above=0 required=5 tests=AWL, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200506/87 X-Sequence-Number: 21688 Hi, I basically need the SQL equivalent of the following pseudo code: BEGIN FOR v IN SELECT * FROM f(4, 'foo') LOOP FOR w IN SELECT * FROM f(v.id, 'bar') LOOP RETURN NEXT W END LOOP; END LOOP; RETURN; Is that possible in SQL? Markus -- Markus Bertheau ☭