pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Kumar <sgnerd@yahoo.com.sg>
Cc: psql <pgsql-sql@postgresql.org>
Subject: Re: How to return a record set from function.
Date: Wed, 27 Aug 2003 08:11:12 -0700 (PDT)
Message-ID: <20030827080844.D68510-100000@megazone.bigpanda.com> (raw)
In-Reply-To: <006901c36c6b$65ab2000$7502a8c0@hdsc.com>


On Wed, 27 Aug 2003, Kumar wrote:

> Dear Friends,
>
> I am newbie to Postgres. I am running 7.3.4 on Linux 7.3. I am using
> Pgadmin tool. I need to return the table rows via record set.
>
> Create table t1 (c1 int, c2 varchar, c3 varchar);
>
> Create or Replace function sel_t1 () returns setof records as '

Why not setof t1?

> select c1, c2, c3 from t1;
> ' Language SQL;
>
> It was fine and created a function. while i execute it as
>
> select sel_t1;

You probably want
select *   from sel_t1() as tab(c1 int, c2 varchar, c3 varchar)
(if you return setof record)

or

select * from sel_t1();
(if you return setof t1)




view thread (4+ messages)  latest in thread

Message-ID: <20030827080844.D68510-100000@megazone.bigpanda.com>
Permalink:  ../20030827080844.D68510-100000@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20030827080844.D68510-100000@megazone.bigpanda.com

 · 

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: sszabo@megazone.bigpanda.com, sgnerd@yahoo.com.sg
  Subject: Re: How to return a record set from function.
  In-Reply-To: <20030827080844.D68510-100000@megazone.bigpanda.com>

* 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