pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lex Berezhny <LBerezhny@DevIS.com>
To: John C <oogly@rogers.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Returning records from a function
Date: 06 Feb 2003 13:57:35 -0500
Message-ID: <1044557855.3555.4.camel@hortus> (raw)
In-Reply-To: <a5cb5d5b.0302012320.6b4c4637@posting.google.com>
References: <a5cb5d5b.0302012320.6b4c4637@posting.google.com>

Hi John,

  It is in the documentation ;-)
 
http://developer.postgresql.org/docs/postgres/plpgsql-control-structures.html

   Also, this tutorial might be helpful:

http://techdocs.postgresql.org/guides/SetReturningFunctions

good luck,

 - lex

On Sun, 2003-02-02 at 02:20, John C wrote:
> I've spent the last few hours trying to come up with a function that
> at the most basic returns the result of a SELECT * FROM <table>.
> 
> This is easy to do in something like MSSQL or Oracle. For example in
> MSSQL i can do something like:
> 
> CREATE PROCEDURE proc_name AS
> 
> BEGIN
>   SELECT * FROM sometable
> END
> 
> 
> How do I do something like that with a Postgresql function/stored
> procedure? All I really want to know is how to by using a function how
> can I return the results of a SELECT * query!?
> 
> The end result of the query I need is more complicated, but I can't
> even get something that easy to work. Are functions unable to return
> result sets?? All of the examples i've seen always return a single
> value, like an int. That doesn't do me any good.
> 
> I want to use a few stored procedures to create some faster processing
> for some queries that involve 3-4 tables plus require some input
> parameters, and return a result set.
> 
> Any help would be appriciated. I've just recently started using
> PostgreSQL and I'm very impressed! I'm sure I'm jsut overlooking
> something easy, but for the life of me i just cant figure it out.
> 
> Thanks,
> John
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
> http://archives.postgresql.org




view thread (2+ messages)

Message-ID: <1044557855.3555.4.camel@hortus>
Permalink:  ../1044557855.3555.4.camel@hortus/
Also on:    postgresql.org/message-id/1044557855.3555.4.camel@hortus

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: LBerezhny@DevIS.com, oogly@rogers.com
  Subject: Re: Returning records from a function
  In-Reply-To: <1044557855.3555.4.camel@hortus>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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