X-Original-To: pgsql-sql@postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by developer.postgresql.org (Postfix) with ESMTP id A0D9C924D84 for ; Fri, 30 May 2003 02:25:11 -0400 (EDT) Received: from developer.postgresql.org ([64.117.224.193]) by localhost (developer.postgresql.org [64.117.224.193:10024]) (amavisd-new) with ESMTP id 04700-09 for ; Fri, 30 May 2003 02:25:06 -0400 (EDT) Received: from anchor-post-39.mail.demon.net (anchor-post-39.mail.demon.net [194.217.242.80]) by developer.postgresql.org (Postfix) with ESMTP id 35CA2924D82 for ; Fri, 30 May 2003 02:25:06 -0400 (EDT) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-39.mail.demon.net with esmtp (Exim 3.36 #2) id 19LdK4-0000P7-0U; Fri, 30 May 2003 07:25:04 +0100 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id E0DF5163A6; Fri, 30 May 2003 07:25:02 +0100 (BST) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id 405651639C; Fri, 30 May 2003 07:25:02 +0100 (BST) Content-Type: text/plain; charset="iso-8859-1" From: Richard Huxton Organization: Archonet Ltd To: "andhie lala" , pgsql-sql@postgresql.org Subject: Re: please helpme ? Date: Fri, 30 May 2003 07:25:02 +0100 User-Agent: KMail/1.4.3 References: <20030530045215.9460.qmail@linuxmail.org> In-Reply-To: <20030530045215.9460.qmail@linuxmail.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200305300725.02622.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by amavisd-new X-Archive-Number: 200305/564 X-Sequence-Number: 13729 On Friday 30 May 2003 5:52 am, andhie lala wrote: > Dear All > > I'am a new user in postgresql, i want to ask about : > > 1. The one who is intended with STORED PROCEDURE, > how its implement and what its surplus. > Version POSTGRESQL that how much possess STRORED PROCEDURE. All PostgreSQL versions for some years now have support for user-defined=20 functions, and 7.3 provides for set-returning functions in plpgsql. > 2. In when I make the function as follows: > > CREATE FUNCTION forward(CHAR(10)) > RETURNS CHAR(10), CHAR(30) > AS 'select no_id, name FROM address where no_id=3D$1;' > Language 'sql'; > > To step forward orders the error ... > Which wants I asked, how make a function that can step forward > RETURNS More than a column > (I want to show 2 columns i.e. no_id and Name) ? In your case you want to do somethine like: CREATE TYPE id_name_type AS (col_id CHAR(10), col_name CHAR(30)); CREATE FUNCTION forward(CHAR(10)) RETURNS SETOF id_name_type AS ... This should do it for you. There are more examples in Section II, Chapter 9= of=20 the Programmer's Guide. Note that you might want to consider the use of varchar() rather than char(= )=20 types - char() is space padded and there is no speed impact on PG. --=20 Richard Huxton