From amajhi@orbitwerks.com Tue Nov 18 06:04:34 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 756E9D1B575 for ; Tue, 18 Nov 2003 06:04:34 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 63770-02 for ; Tue, 18 Nov 2003 02:04:04 -0400 (AST) Received: from virgosupercluster.orbitwerks.com (user-112v0a2.biz.mindspring.com [66.47.129.66]) by svr1.postgresql.org (Postfix) with ESMTP id F269ED1B4E8 for ; Tue, 18 Nov 2003 02:03:51 -0400 (AST) Received: from 352AkasMajhi (unknown [202.140.40.10]) by virgosupercluster.orbitwerks.com (Postfix) with ESMTP id 761E9141247 for ; Mon, 17 Nov 2003 22:03:49 -0800 (PST) Message-ID: <000e01c3ad99$e76a70e0$740c640a@352AkasMajhi> From: "Majhi, Akas" To: Subject: multiple function declarations Date: Tue, 18 Nov 2003 11:34:57 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_000B_01C3ADC7.FE209070" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.1 tagged_above=0.0 required=5.0 tests=HTML_50_60 X-Spam-Level: X-Archive-Number: 200311/208 X-Sequence-Number: 16023 This is a multi-part message in MIME format. ------=_NextPart_000_000B_01C3ADC7.FE209070 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi , I have a plpgsql function (MainFunc) that intends to reuse a a particular b= lock of code. So, I intend to make that particulat block of code into anoth= er function. (say, HelperFunc) My question is 1. Can I declare a function (HelperFunc) inside the main function (MainFun= c) 2. If yes then how. Thanks in advance -akas ------=_NextPart_000_000B_01C3ADC7.FE209070 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hi ,
 
I have a plpgsql function (MainFunc) that = intends=20 to reuse a a particular block of code. So, I intend to make that particulat= =20 block of code into another function. (say, HelperFunc)
 
My question is
 
1. Can I declare a function (HelperFunc) i= nside the=20 main function  (MainFunc)
 
2. If yes then how.
 
Thanks in advance
-akas
------=_NextPart_000_000B_01C3ADC7.FE209070-- From peter_e@gmx.net Tue Nov 18 06:22:58 2003 X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 9D0A5D1B54C for ; Tue, 18 Nov 2003 06:22:58 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 64478-07 for ; Tue, 18 Nov 2003 02:22:27 -0400 (AST) Received: from mail.gmx.net (pop.gmx.net [213.165.64.20]) by svr1.postgresql.org (Postfix) with SMTP id 18D6ED1B50F for ; Tue, 18 Nov 2003 02:22:26 -0400 (AST) Received: (qmail 21383 invoked by uid 65534); 18 Nov 2003 06:22:26 -0000 Received: from dsl-082-082-166-244.arcor-ip.net (EHLO [192.168.2.136]) (82.82.166.244) by mail.gmx.net (mp027) with SMTP; 18 Nov 2003 07:22:26 +0100 X-Authenticated: #495269 Date: Tue, 18 Nov 2003 07:22:41 +0100 (CET) From: Peter Eisentraut X-X-Sender: peter@peter.localdomain To: "Majhi, Akas" Cc: pgsql-sql@postgresql.org Subject: Re: multiple function declarations In-Reply-To: <000e01c3ad99$e76a70e0$740c640a@352AkasMajhi> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200311/209 X-Sequence-Number: 16024 Majhi, Akas writes: > 1. Can I declare a function (HelperFunc) inside the main function (MainFunc) > 2. If yes then how. You could do it if you create the CREATE FUNCTION command in a string variable and then use EXECUTE to run it, but the normal way would be to declare it outside. There is usually no reason not to do that. -- Peter Eisentraut peter_e@gmx.net