From: Richard Huxton <dev@archonet.com>
To: Kumar <sgnerd@yahoo.com.sg>
To: psql <pgsql-sql@postgresql.org>
Subject: Re: How to return a record set from function.
Date: Wed, 27 Aug 2003 14:50:12 +0100
Message-ID: <200308271450.12485.dev@archonet.com> (raw)
In-Reply-To: <006901c36c6b$65ab2000$7502a8c0@hdsc.com>
References: <006901c36c6b$65ab2000$7502a8c0@hdsc.com>
On Wednesday 27 August 2003 08:18, 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 '
> select c1, c2, c3 from t1;
> ' Language SQL;
>
> It was fine and created a function. while i execute it as
>
> select sel_t1;
>
> I got the following error.
>
> ERROR: Cannot display a value of type RECORD
You probably want to return "setof t1" and then do:
SELECT * FROM sel_t1();
--
Richard Huxton
Archonet Ltd
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: dev@archonet.com, sgnerd@yahoo.com.sg
Subject: Re: How to return a record set from function.
In-Reply-To: <200308271450.12485.dev@archonet.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