| From: | Michael Fuhr <mike(at)fuhr(dot)org> | 
|---|---|
| To: | gustavo halperin <ggh(dot)develop(at)gmail(dot)com> | 
| Cc: | pgsql-general(at)postgresql(dot)org | 
| Subject: | Re: Create function problem | 
| Date: | 2006-08-04 16:23:19 | 
| Message-ID: | 20060804162319.GA76996@winnie.fuhr.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-general | 
On Fri, Aug 04, 2006 at 06:44:16PM +0300, gustavo halperin wrote:
> Michael Fuhr wrote:
> >Since the function has OUT parameters you can use "RETURNS SETOF record"
> >like this:
> >
> >CREATE FUNCTION funcname(<params>) RETURNS SETOF record AS $$
> ><body>
> >$$ LANGUAGE SQL
>
> What do you mean with the word "record", can you give an example of how 
> this "record" looks for two columns ?
"record" means the literal word "record". Example:
CREATE FUNCTION show_tables(OUT schema_name text, OUT table_name text)
RETURNS SETOF record AS $$
  SELECT table_schema, table_name
  FROM information_schema.tables;
$$ LANGUAGE sql;
SELECT * FROM show_tables();
-- 
Michael Fuhr
| From | Date | Subject | |
|---|---|---|---|
| Next Message | gustavo halperin | 2006-08-04 16:35:16 | Re: Create function problem | 
| Previous Message | Rohit Prakash Khare | 2006-08-04 16:13:13 | Recover lost database from DATA folder |