X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 24F3D47610A for ; Sun, 23 Mar 2003 23:43:10 -0500 (EST) Received: from trade-india.com (ns5.trade-india.com [66.234.10.13]) by postgresql.org (Postfix) with SMTP id 1D167475EFD for ; Sun, 23 Mar 2003 23:43:09 -0500 (EST) Received: (qmail 5720 invoked by uid 505); 24 Mar 2003 04:42:57 -0000 Received: from mallah@trade-india.com by ns5.trade-india.com by uid 502 with qmail-scanner-1.15 (uvscan: v4.1.60/v4171. Clear:. Processed in 1.79809 secs); 24 Mar 2003 04:42:57 -0000 Received: from mail-relay.trade-india.com (HELO system67.trade-india-local.com) (203.196.129.235) by ns5.trade-india.com with SMTP; 24 Mar 2003 04:42:55 -0000 From: Rajesh Kumar Mallah Organization: Infocom Network Limited To: "David Witham" , "Mario Alberto Soto Cordones" , Subject: Re: FUNCTIONS PROBLEM Date: Mon, 24 Mar 2003 10:13:37 +0530 User-Agent: KMail/1.5 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200303241013.37327.mallah@trade-india.com> X-Spam-Status: No, hits=-33.1 required=5.0 tests=BAYES_01,EMAIL_ATTRIBUTION,IN_REP_TO,QUOTED_EMAIL_TEXT, REFERENCES,REPLY_WITH_QUOTES,SIGNATURE_SHORT_SPARSE, USER_AGENT autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200303/534 X-Sequence-Number: 12573 CREATE TYPE can be used as well i think in that case "as (val1 int, val2 int, val3 real, val4 char);" need not be done while selecting. regds mallah On Monday 24 Mar 2003 4:48 am, David Witham wrote: > Hi Mario, > > I have used a record type to do this: > > create myfunc() returns record as ' > > declare > return_val record; > col1 int; > col2 int; > col3 real; > col4 char; > > col1 := 5; > col2 := 10; > col3 := 2.7; > col4 := ''z''; > > select col1,col2,col3,col4 into return_val; > return return_val; > end; > ' language 'plpgsql'; > > When you call the function you need to specify the expected output: > > select * from myfunc() as (val1 int, val2 int, val3 real, val4 char); > > See the SELECT reference page in the documentation. > > There are other ways (which may be better) to do this that don't require > the output types to be specified with the query but this is the one I got > going first so I stuck with it. Hope this helps. > > Regards, > David Witham > Telephony Platforms Architect > Unidial > > -----Original Message----- > From: Mario Alberto Soto Cordones [mailto:mario_soto@compuall.cl] > Sent: Friday, 21 March 2003 09:26 > To: pgsql-sql@postgresql.org > Subject: [SQL] FUNCTIONS PROBLEM > Importance: High > > > Hi. > > i have a function and i need to return 4 fields but not work, > > any idea , please > > thank > > mario > > > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) -- Rajesh Kumar Mallah, Project Manager (Development) Infocom Network Limited, New Delhi phone: +91(11)6152172 (221) (L) ,9811255597 (M) Visit http://www.trade-india.com , India's Leading B2B eMarketplace.