Re: How to create stored procedure in PostgreSQL? - Mailing list pgsql-general

From Brandon Craig Rhodes
Subject Re: How to create stored procedure in PostgreSQL?
Date
Msg-id w6fzqs6u22.fsf@guinness.ts.gatech.edu
Whole thread Raw
In response to How to create stored procedure in PostgreSQL?  (Yolanda Valverde <yvalverde@chiusac.com>)
List pgsql-general
Yolanda Valverde <yvalverde@chiusac.com> writes:

> Me gustaría saber como crear procedimientos almacenados en PostgreSQL, yo
> he trabajado con funciones, pero el problema que tengo es que la funcion
> retorna un solo valor; lo que a mi me interesa saber es como retornar
> varios valores.

create table two_integers (integer1 int, integer2 int);

create function square_and_cube(int) RETURNS setof two_integers
AS 'select $1*$1, $1*$1*$1;' LANGUAGE SQL;

SELECT * FROM square_and_cube(3);
-->
         integer1 | integer2
        ----------+----------
                9 |       27

http://www3.us.postgresql.org/users-lounge/docs/7.3/postgres/xfunc-tablefunctions.html

--
Brandon Craig Rhodes                         http://www.rhodesmill.org/brandon
Georgia Tech                                            brandon@oit.gatech.edu

pgsql-general by date:

Previous
From: Jason Hihn
Date:
Subject: Re: How to create stored procedure in PostgreSQL?
Next
From: chris.gamble@CPBINC.com
Date:
Subject: Restore from 7.3 to 7.2