Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 95E2A63281F for ; Sat, 4 Apr 2009 01:28:46 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 84578-05 for ; Sat, 4 Apr 2009 01:28:44 -0300 (ADT) Received: from mx1.hub.org (mx1.hub.org [200.46.208.106]) by mail.postgresql.org (Postfix) with ESMTP id 6C9F8632540 for ; Sat, 4 Apr 2009 01:28:44 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from a2s36.a2hosting.com (a2s36.a2hosting.com [74.126.18.130]) by mx1.hub.org (Postfix) with ESMTP id 31C0F125A7EA for ; Sat, 4 Apr 2009 01:28:43 -0300 (ADT) Received: from adsl-70-98-232.tys.bellsouth.net ([98.70.98.232] helo=[192.168.1.16]) by a2s36.a2hosting.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69) (envelope-from ) id 1LpxUn-0001qu-4Y; Sat, 04 Apr 2009 00:28:41 -0400 Cc: pgsql-sql@postgresql.org Message-Id: <29505E7D-05C7-4F8A-91AD-C5596FA51987@pgedit.com> From: John DeSoi To: Peter Koczan In-Reply-To: <4544e0330904031403i218fdb3cxf18d8971ff284290@mail.gmail.com> Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v930.3) Subject: Re: pl/pgsql or control structures outside of a function? Date: Sat, 4 Apr 2009 00:28:40 -0400 References: <4544e0330904031403i218fdb3cxf18d8971ff284290@mail.gmail.com> X-Mailer: Apple Mail (2.930.3) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - a2s36.a2hosting.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - pgedit.com X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200904/38 X-Sequence-Number: 32384 On Apr 3, 2009, at 5:03 PM, Peter Koczan wrote: > Is there any way to use PL/pgSQL code outside of a function? No. > > > The reason I'm asking is that I'm porting some code from > sybase/isql/SQR, and it allows some control code structures to be used > in an sql script. For instance, CASE might work for you. http://www.postgresql.org/docs/8.3/interactive/functions-conditional.html John DeSoi, Ph.D.