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 3F1FFD1B575 for ; Tue, 21 Oct 2003 18:44:29 +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 26520-04 for ; Tue, 21 Oct 2003 15:43:58 -0300 (ADT) Received: from mailhub2.sghms.ac.uk (firewall.sghms.ac.uk [194.82.50.2]) by svr1.postgresql.org (Postfix) with ESMTP id D35B6D1B51A for ; Tue, 21 Oct 2003 15:43:56 -0300 (ADT) Received: from [194.82.51.24] (helo=imail) by mailhub2.sghms.ac.uk with esmtp (Exim 4.24) id 1AC1U2-0003kl-Sa; Tue, 21 Oct 2003 19:43:54 +0100 Received: from [172.16.20.3] (mrc1-003.sghms.ac.uk [172.16.20.3]) by imail.sghms.ac.uk (iPlanet Messaging Server 5.1 HotFix 0.7 (built May 7 2002)) with ESMTPA id <0HN400L63EP6E4@imail.sghms.ac.uk>; Tue, 21 Oct 2003 19:43:54 +0100 (BST) Date: Tue, 21 Oct 2003 19:42:36 +0100 From: Adam Witney Subject: Re: how to create a multi columns return function ? In-reply-to: To: jclaudio@capitol.fr, pgsql-sql Message-id: MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT User-Agent: Microsoft-Entourage/10.1.1.2418 X-MailScanner-Information: Please contact sysadmin at sghms.ac.uk for more information X-MailScanner-MH2: Found to be clean X-MailScanner-SpamCheck: not spam, SpamAssassin (score=-2.9, required 5, APARENTLY_FROM_MYSELF 1.00, BAYES_00 -4.90, FROM_SGHMS -1.00, MY_NO_QU 0.50, MY_OBFUX 0.50, MY_OBFUY 1.00) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200310/273 X-Sequence-Number: 15673 Take a look at the section on 'SQL Functions Returning Sets' http://www.postgresql.org/docs/7.3/static/xfunc-sql.html#AEN31304 > Hi > > I'm moving databases from sybase to postgres. > But I have difficulties in creating a postgres equivalent to the sybase stored > procedures... > > Apparently, Postgres functions should work, but the syb stored procedures get > only one parameter and return several colums > > Here's the code I wrote in postgresql : > > create function function_name( int ) returns text > AS ' SELECT column1, column2, column3,...,column15 > FROM table_name > WHERE colum1 = $1 AND column5 = \'specific value\' AND column8 = > \'specific_value2 \' ' > LANGUAGE 'SQL'; > > and I get the message error : returns multi columns > > I'm wondering too if It's possible to create a view with a parameter if > functions don't work. > > Has anybody faced the same problem ? > > I need help > > thanks -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.