pg.ddx.io pgsql-sql@postgresql.org mailing list archivehelp / color / mirror / Atom feed
please helpme ? 2+ messages / 2 participants [nested] [flat]
* please helpme ? @ 2003-05-30 04:52 andhie lala <andhie_sql@linuxmail.org> 2003-05-30 06:25 ` Re: please helpme ? Richard Huxton <dev@archonet.com> 0 siblings, 1 reply; 2+ messages in thread From: andhie lala @ 2003-05-30 04:52 UTC (permalink / raw) To: pgsql-sql 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. 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=$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) ? thank's best regards -- ______________________________________________ http://www.linuxmail.org/ Now with e-mail forwarding for only US$5.95/yr Powered by Outblaze ^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: please helpme ? 2003-05-30 04:52 please helpme ? andhie lala <andhie_sql@linuxmail.org> @ 2003-05-30 06:25 ` Richard Huxton <dev@archonet.com> 0 siblings, 0 replies; 2+ messages in thread From: Richard Huxton @ 2003-05-30 06:25 UTC (permalink / raw) To: andhie lala <andhie_sql@linuxmail.org>; pgsql-sql 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 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=$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 the Programmer's Guide. Note that you might want to consider the use of varchar() rather than char() types - char() is space padded and there is no speed impact on PG. -- Richard Huxton ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2003-05-30 06:25 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2003-05-30 04:52 please helpme ? andhie lala <andhie_sql@linuxmail.org> 2003-05-30 06:25 ` Richard Huxton <dev@archonet.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox