pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: imad <immaad@gmail.com>
To: Mark Simon <mark@manngo.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Create Function (SQL)
Date: Sun, 5 Nov 2006 16:59:14 +0500
Message-ID: <1f30b80c0611050359l5208a40fo5276f7df3cf65371@mail.gmail.com> (raw)
In-Reply-To: <454D82CC.6090503@manngo.net>
References: <454D82CC.6090503@manngo.net>

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@manngo.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@manngo.net
>  web: http://www.manngo.net
>
> Resume: http://mark.manngo.net



view thread (2+ messages)

Message-ID: <1f30b80c0611050359l5208a40fo5276f7df3cf65371@mail.gmail.com>
Permalink:  ../1f30b80c0611050359l5208a40fo5276f7df3cf65371@mail.gmail.com/
Also on:    postgresql.org/message-id/1f30b80c0611050359l5208a40fo5276f7df3cf65371@mail.gmail.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: immaad@gmail.com, mark@manngo.net
  Subject: Re: Create Function (SQL)
  In-Reply-To: <1f30b80c0611050359l5208a40fo5276f7df3cf65371@mail.gmail.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