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 13FB5D9CA2 for ; Fri, 30 Sep 2005 20:34:30 -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 36374-04 for ; Fri, 30 Sep 2005 23:34:25 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 4BE3CD9CB8 for ; Fri, 30 Sep 2005 20:34:26 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j8UNYIcQ068512 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 30 Sep 2005 17:34:20 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j8UNYIxF044323; Fri, 30 Sep 2005 17:34:18 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j8UNYHug044322; Fri, 30 Sep 2005 17:34:17 -0600 (MDT) (envelope-from mfuhr) Date: Fri, 30 Sep 2005 17:34:17 -0600 From: Michael Fuhr To: "Thomas F. O'Connell" Cc: mario.splivalo@mobart.hr, pgsql-sql@postgresql.org Subject: Re: EXECUTE with SELECT INTO variable, or alternatives Message-ID: <20050930233417.GA44295@winnie.fuhr.org> References: <1128017805.9061.5.camel@localhost.localdomain> <1045972B-4D8E-4801-A958-76A1DB6FAD0B@sitening.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1045972B-4D8E-4801-A958-76A1DB6FAD0B@sitening.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 required=5 tests=[AWL=0.006] X-Spam-Level: X-Archive-Number: 200509/306 X-Sequence-Number: 22853 On Fri, Sep 30, 2005 at 03:59:06PM -0500, Thomas F. O'Connell wrote: > Per the docs: > > "The results from SELECT commands are discarded by EXECUTE, and > SELECT INTO is not currently supported within EXECUTE. So there is no > way to extract a result from a dynamically-created SELECT using the > plain EXECUTE command. There are two other ways to do it, however: > one is to use the FOR-IN-EXECUTE loop form described in Section > 35.7.4, and the other is to use a cursor with OPEN-FOR-EXECUTE, as > described in Section 35.8.2." 8.1 will have EXECUTE ... INTO. http://developer.postgresql.org/docs/postgres/plpgsql-statements.html#PLPGSQL-STATEMENTS-EXECUTING-DYN -- Michael Fuhr