Re: how to create a multi columns return function ?

From: Adam Witney <awitney(at)sghms(dot)ac(dot)uk>
To: jclaudio(at)capitol(dot)fr, pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: how to create a multi columns return function ?
Date: 2003-10-21 18:42:36
Message-ID: BBBB3CAC.26B9E%awitney@sghms.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Take a look at the section on 'SQL Functions Returning Sets'

http://www.postgresql.org/docs/7.3/static/xfunc-sql.html#AEN31304

> Hi
>
> I'm moving databases from sybase to postgres.
> But I have difficulties in creating a postgres equivalent to the sybase stored
> procedures...
>
> Apparently, Postgres functions should work, but the syb stored procedures get
> only one parameter and return several colums
>
> Here's the code I wrote in postgresql :
>
> create function function_name( int ) returns text
> AS ' SELECT column1, column2, column3,...,column15
> FROM table_name
> WHERE colum1 = $1 AND column5 = \'specific value\' AND column8 =
> \'specific_value2 \' '
> LANGUAGE 'SQL';
>
> and I get the message error : returns multi columns
>
> I'm wondering too if It's possible to create a view with a parameter if
> functions don't work.
>
> Has anybody faced the same problem ?
>
> I need help
>
> thanks

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Josh Berkus 2003-10-21 18:43:02 Re: plpgsql related question: intervals and variables
Previous Message Tom Lane 2003-10-21 17:27:34 Re: Many joins: monthly summaries S-L--O--W