Re: Create Function (SQL)

From: imad <immaad(at)gmail(dot)com>
To: "Mark Simon" <mark(at)manngo(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Create Function (SQL)
Date: 2006-11-05 11:59:14
Message-ID: 1f30b80c0611050359l5208a40fo5276f7df3cf65371@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

You can return a record:

create function thing(text) returns record as 'select * from whatever
where id=$1' language sql;

Hope this helps.

--Imad
www.EnterpriseDB.com

On 11/5/06, Mark Simon <mark(at)manngo(dot)net> wrote:
>
> I am trying to create a simple function using SQL rather than PGSQL. At
> this point, it's just for the exercise.
>
> Is it possible to create a function similar to the following:
>
> create function thing(text) as select * from whatever where id=$1;
>
> Do I need to specify all of the columns from the table (whatever) as out
> parameters, or as a return type, or can I have a generic table returned from
> this?
>
> Thanks,
>
> Mark
>
> --
>
>
> Mark Simon
>
> Manngo Net Pty Ltd
>
> Phone/Fax: 1300 726 000
> mobile: 0411 246 672
>
> email: mark(at)manngo(dot)net
> web: http://www.manngo.net
>
> Resume: http://mark.manngo.net

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message stig erikson 2006-11-05 18:46:30 a celko-puzzle from long time ago
Previous Message Peter Eisentraut 2006-11-05 07:38:56 Re: Create View