| From: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
|---|---|
| To: | Kumar <sgnerd(at)yahoo(dot)com(dot)sg> |
| Cc: | psql <pgsql-sql(at)postgresql(dot)org> |
| Subject: | Re: How to return a record set from function. |
| Date: | 2003-08-27 15:11:12 |
| Message-ID: | 20030827080844.D68510-100000@megazone.bigpanda.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
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)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Richard A. DeVenezia | 2003-08-27 15:30:24 | Q: Multicolumn lookup, Join or Sub-query ? |
| Previous Message | Bruce Momjian | 2003-08-27 14:46:23 | Re: Canceling other backend's query |